- #1
nabeel17
- 57
- 1
I have to plot a bunch of cosine waves and then add them up but my problem is that each indiviudal wave looks really weird when I plot and not like a cos wave. The program runs and plots the final result but I'm not sure how accurate it is because when I plot each individual cos wave I know it should not look like that
This is my method,
t=[0:119];
a1=9.8;
f1=200;
P1=0;
s1=a1*cos(2*pi*f1*t+P1);
t=[0:119];
a2=7.6;
f2=145;
P2=30;
s2=a2*cos(2*pi*f2*t+P2);
t=[0:119];
a3=5.4;
f3=93;
P3=70;
s3=a3*cos(2*pi*f3*t+P3);
t=[0:119];
a4=3.2;
f4=58;
P4=160;
s4=a4*cos(2*pi*f4*t+P4);
t=[0:119];
a5=1.0;
f5=35;
P5=320;
s5=a5*cos(2*pi*f5*t+P5);
S1=s1+s2+s3+s4+s5;
plot(t,S1)
any help would be appreciated
This is my method,
t=[0:119];
a1=9.8;
f1=200;
P1=0;
s1=a1*cos(2*pi*f1*t+P1);
t=[0:119];
a2=7.6;
f2=145;
P2=30;
s2=a2*cos(2*pi*f2*t+P2);
t=[0:119];
a3=5.4;
f3=93;
P3=70;
s3=a3*cos(2*pi*f3*t+P3);
t=[0:119];
a4=3.2;
f4=58;
P4=160;
s4=a4*cos(2*pi*f4*t+P4);
t=[0:119];
a5=1.0;
f5=35;
P5=320;
s5=a5*cos(2*pi*f5*t+P5);
S1=s1+s2+s3+s4+s5;
plot(t,S1)
any help would be appreciated