How can plot the following signal?
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Wayne King
2012-8-12
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.
更多回答(1 个)
Wayne King
2012-8-12
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 个评论
Wayne King
2012-8-12
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!