mardi 6 juin 2017

Sine Wave Plotting

I am trying to generate a sin wave which gets chopped regularly in a time interval of 0.004 second.I am a newbie in matlab. I tried the following code but it doesn't generate the correct output.Please suggest some modification.

f=10000000000;
k=0;
for i=0:0.004:1
    k=k+1;
    if(mod(k,2)~=0)
        t=i:0.001:i+0.004;
        y=sin(2*3.14*f*t);
        plot(t,y);
    else
        t=i:0.001:i+0.004;
        y=0;
        plot(t,y);
    end
end

Aucun commentaire:

Enregistrer un commentaire