Clear Filters
Clear Filters

How can plot the following signal?

1 view (last 30 days)
I have a sine wave like this 230*sin(2*pi*50*t) this signal is persisted for 0.04 seconds,and at 0.04 second the signal's frequency started to change(only frequency, no change in magnitude), it's not step change, it's changing slowly as the time passes,from 50Hz to 50.1 Hz(50.01,50.05,50.10.... 50.79..50.1 like this or similar). At 0.08 sec the frequency reached at 50.1 Hz and the signal continued with this frequency till 0.12 sec with 50.1 Hz.At 0.12 sec the frequency started to decrease from 50.1 Hz to 50 Hz slowly as mentioned above from sec and settled at 50 Hz at 0.16 sec.And continued with this 50 Hz frequency till 0.20 sec.I am getting an error while trying to plot.How can i program and plot this signal? can any one help in this?

Accepted Answer

Wayne King
Wayne King on 12 Aug 2012
Then, you just make the adjustments:
t = 0:0.0001:0.20;
sig = zeros(size(t));
x1 = 230*sin(2*pi*50*t(1:400));
x2 = 230*(chirp(t(401:800),50,0.08,50.1,'linear',-92));
x3 = 230*sin(2*pi*50.1*t(801:1200));
x4 = 230*(chirp(t(1201:1600),50.1,0.16,50,'linear',-90));
x5 = 230*sin(2*pi*50*t(1601:end));
sig = cat(2,x1,x2,x3,x4,x5);
You'll want to look at the values of x1(end) and x2(1) x3(end) x4(1) etc to adjust the starting phase of the chirp if necessary.

More Answers (1)

Wayne King
Wayne King on 12 Aug 2012
I think you need to define the signal piecewise. Something like:
t = 0:0.001:0.20;
sig = zeros(size(t));
x1 = 230*cos(2*pi*50*t(1:40));
x2 = 230*(chirp(t(41:80),50,0.08,50.1));
x3 = 230*cos(2*pi*50.1*t(81:120));
x4 = 230*(chirp(t(121:160),50.1,0.16,50));
x5 = 230*cos(2*pi*50*t(161:end));
sig = cat(2,x1,x2,x3,x4,x5);
plot(t,sig)
You may have to use the optional input argument, phi, in chirp() to make sure you don't have any jumps where the linear chirp sections begin and end.
  3 Comments
Wayne King
Wayne King on 12 Aug 2012
I'm not sure what you're talking about. What is the difference between a cosine and sine, just phase. And the chirp() is giving you the linear increase in the sine wave frequency that you asked for.
mskumarsajeesh mskumar
mskumarsajeesh mskumar on 12 Aug 2012
No difference wayne but i need a sinusoidal signal which is to be zero at t=0 and t=0.02 sec (50Hz).That's what i said i am so particular about 230.sin.could u now give an answer?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!