# Plot of a mixed signal in matlab

I have the following signal

xa=4000.*sin(2*pi*f1*t)+1000.*sin(2*pi*f2*t)+ 500.*sin(2*pi*f3*t);


and the values of f1,f2 and f3 are

f1=50000;
f2=500000;
f3=2500000;


and with the above information I have to find a figure like in MATLAB. I am using the following code but not getting a figure like this.

close all;
clc;
%subplot(2,1,1)
t=0:0.0005:1;
f1=50000;
f2=500000;
f3=2500000;
xa=4000.*sin(2*pi*f1*t)+1000.*sin(2*pi*f2*t)+ 500.*sin(2*pi*f3*t);
% xa=cos(2*pi*f*t);
plot(t,xa)


I also tried with the different time intervals t but not getting the required figure.

• What does your plot look like? I think your t interval is WAY off. The time span in the plot is 100us. Try with t=0:0.00000005:0.0001 or something like that. – Peter Karlsen Oct 25 '18 at 12:45
• @PeterKarlsen Yes you are right. I tried it and it worked. Why don't you post it as answer? – Hazem Oct 25 '18 at 12:49