implementing input signal with 2 different frequencies for different time span
1 view (last 30 days)
Show older comments
Hello, I want to simulate a signal with 2 different frequencies for 2 different time span. For example..
ttotal = 0:200
for timespan t1 = 0:100
input signal fi= cos (w1*t1)
for timespan t2 = 100:200
input signal fi = cos (w2*t2)
for 0:100 the w1(frequency) is different and for 100:200 the w2 (frequency) is different.
in this w1 and w2 values are different .,,i have code for input signal with constant frequency for whole time span and i want to simulate it for changing frequency for different time span as above mentioned.
in the following code time span is 0:200 and input signal is
fi = cos (10*timespan)
here w = 10
**********************************
Tspan= 0:0.01:200; % time vector
fi = cos(10*Tspan)
ti=Tspan;
[T,Y]=ode45(@(t,y) myeqd(t,y,ti,fi),Tspan,[1;1;30]);
plot (T,Y)
************************** could any one tell me how to do it ? is parallel simulation is possible in MATLAB ? and if possible then how to do it ?
0 Comments
Accepted Answer
Azzi Abdelmalek
on 24 Jan 2013
Edited: Azzi Abdelmalek
on 24 Jan 2013
I don't think that you need a parallel computing. You just need concatenation
w1=10;
w2=20;
Tspan1=0:0.01:100;
Tspan2= 100.01:0.1:200;
fi1 = cos(w1*Tspan1);
fi2 = cos(w2*Tspan2);
Tspan=[Tspan1 Tspan2];
fi=[fi1 fi2]
ti=Tspan;
[T,Y]=ode45(@(t,y) myeqd(t,y,ti,fi),Tspan,[1;1;30]);
plot (T,Y)
More Answers (0)
See Also
Categories
Find more on Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!