Go Down

Topic: matlab io chirp signal (Read 1 time) previous topic - next topic

shaker


Hi,
Forgive my ignorance i am new to this, and i have done a few (unsuccessful) searches to try and solve this.

i am trying to output a chirp signal from my arduino mega pwm out, from maltab. however i cannot put a function as the output. I have tried to use a for loop to solve this but have come to no avail!
any help or suggestions would be much appreciated. the code i have tried to use is as follows.


clear all; clc;

%connect board

a = arduino('/dev/cu.usbserial-A9007LCD')

%specify pin modes

a.pinMode(3,'output');


t = [0:0.01:10];

ch = chirp(t,0.0001,10,10);

for i = 0:numel(ch)
   
    a.analogWrite(3,ch(i,:))
    pause(0.01)
   
end


Thanks very much

Ran

shaker

does anyone have any useful suggestions?

Thanks


jaegerw

How did you solve this, i am trying to create a chirp signal to sweep pwm on motors to use for a systems id project with an excited input and the output from a distance sensor to estimate the transfer function using least squares and my equation works in matlab and excel but arduino is not calculating right.... please help me

Go Up