Posts filed under 'Programming'
I recently experienced this error while using MATLAB. Error using maple… Error integer too large in context … This happens when I try to simulate an ESPRIT DOA estimation using atan function with symbolic expressions. The solution is to use:
clear maplemex % this works for me, this basically clears the Maple workspace
% and reinitializes the Maple kernel
April 18th, 2009
A simple app. using PIC18F4520 to display frequency and period measurement of an analog square wave input. Code is written in C, interrupts and internal timer1 are utilized. Display is on 2 lined LCD screen.


Schematic:

March 18th, 2009
MATLAB is a great tool. I recently wrote a code to perform an adaptive median filtering on a somewhat noisy image. The code works great in removing noise on an image…. It is a simple code that I wrote in a few minutes using MATLAB… for simplification the code does not render regions near the edges… the spatial mask which is a three by three window could not process the edges since it is out of bound…. I could have use padding and pad the edges so that the spatial mask can process the edges…. but you get the idea…and the code…Adaptive Filter
Adaptive median filtering is not the only way to remove noise on an image. It depends on the what kind of noise exists in the image. For example, if the image has a salt noise only, then using contraharmonic mean filter with Q=-1.5 probably will do the job, or if you have a pepper noise only, then using contraharmonic mean filter with Q=1.5 probably will do the job.
Also, extracting noise from an image, not necessarily we have to use time domain or spatial domain. We can also use the frequency domain such as by using band reject filter or notch filter to reject noises at certain region of the fourier spectrum.
May 27th, 2007
In verilog, there are two types of reset, synchronous reset and asynchronous reset. In synchronous reset, reset is sampled with respect to clock, whereas in asynchronous reset, reset is not sampled with respect to clock. There are advantages and disadvanteges of using asynchronous reset and they are it requires less gates to implement, does not requires clock to be active always and it is fast. However it suffers from metastability problem.
An asynchronous D Flip Flop:
module dff_async_reset(data,clk,reset,q);
input data, clk, reset;
output q;
reg q;
always @(posedge clk or negedge reset) //for asynchronous
if (~reset) begin
q = 1′b0;
end else begin
q = data;
end
endmodule
A synchronous D Flip Flop:
module dff_sync_reset(data,clk,reset,q);
input data, clk, reset;
output q;
reg q;
always @ (posedge clk)
if (~reset) begin
q = 1′b0;
end else begin
q = data;
end
endmodule
Notice the always block which distinguishes between asynchronous and synchronous reset.
September 20th, 2006
Do people really click on their browser’s back icon? Yes, they probably do. Would adding a link that brings a user back to the previous page a smart idea? Yes, maybe it is a smart idea. The reason is because in most occasion the user’s mouse pointer would usually be around the area of the page but not at the top left hand corner of the browser. Therefore, a back link on the page makes going back to the previous page much easier. Below is a short code snippet that I have been using if I am to write a PHP script on my own and I think it is very effective.
if (isset($HTTP_REFERER)) {
echo “<a href=’$HTTP_REFERER’>Back</a>”;
} else {
echo “<a href=’javascript:history.back()’>Back</a>”;
}
The above PHP code basically says that if the predefined variable HTTP_REFERER is set, then print a back link to the previous page, else use the java script method history.back(). Simple as that and it is fun.
May 9th, 2006