how to make a signal in matlab from ultrasonic sensor?

14 views (last 30 days)
Hi everyone! I would like to ask what should I use to make a signal in matlab from ultrasonic sensors. I want to generate signals depending on what the sensors are detecting. For example, if I put a water bottle in front of the sensors, it would generate a signal and then I would try another object like a can, it would also generate a signal. Since its 2 different object, the possible signals are different. I want to know the equation needed to generate different signals depending on the detected object.
i= 1 : 10*4 % time vector
data(i) = str2double(fscanf(s1)); %scan from arduino
ix(i) = i/10;
%%Time specifications:
Fs = 100; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 1; % seconds
t = (0:dt:StopTime-dt)'; % wave per seconds
%%Sine wave:
x = sin(2*pi*t*data);
plot(x, 'b')
end;
This is my example of codes. It generates signal from sensors, but the problem is that it would generate the same structure of signals even though its an obvious different object. I want it to be different because I will use the data for object recognition
I hope someone can help me. Thanks.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!