andrew257
Member level 2
Hi All,
I am having trouble understanding why my plots in matlab are looking the way they look.
For example i am plotting 3 sine waves with 3 different frequencies and amplitudes.
I am then sampling the 3 waves at a given frequency and at a given number of samples.
i then plot the 3 waves vs sample number. This works great and all is visible and clear.
However when i come to plot the 3 waves vs time rather than sample the waves become distorted and triangular like. Is there a reason for this? i assumed if the sample and time were identical in the same point in time (i.e after 200 samples this equates to 1 second, therefore showing a plot after 200 samples or 1 second would look the exact same????
am i missing something here?
Thank you
Andy
the code i am using is as follows
fs=1e3;f=[100;200;400]; n=0:1000;
a=[1,2,3,];
s=sin(f/fs*n*2*pi);
plot(n,s)
or for time i include
t=n/fs
plot(t,s)
I am having trouble understanding why my plots in matlab are looking the way they look.
For example i am plotting 3 sine waves with 3 different frequencies and amplitudes.
I am then sampling the 3 waves at a given frequency and at a given number of samples.
i then plot the 3 waves vs sample number. This works great and all is visible and clear.
However when i come to plot the 3 waves vs time rather than sample the waves become distorted and triangular like. Is there a reason for this? i assumed if the sample and time were identical in the same point in time (i.e after 200 samples this equates to 1 second, therefore showing a plot after 200 samples or 1 second would look the exact same????
am i missing something here?
Thank you
Andy
the code i am using is as follows
fs=1e3;f=[100;200;400]; n=0:1000;
a=[1,2,3,];
s=sin(f/fs*n*2*pi);
plot(n,s)
or for time i include
t=n/fs
plot(t,s)