generating/plotting aperiodic functions
显示 更早的评论
Hey guyssss,
Can someone explain to me how I can define an aperiodic square function in MATLAB? This is the code I have for time:
TimeStep = 0.0001*2*pi; %time increment
Time.Start = 0; %time interval starting time
Time.End = 10*2*pi; %time interval ending time
Time = Time.Start:TimeStep:Time.End;
I want to be able to change the width and amplitude of the function. Any help would be greatly appreciated :)
回答(1 个)
Fangjun Jiang
2011-11-11
f below will be your function.
f=@(t,StartTime,EndTime,Amplitude) Amplitude*and(StartTime<t,t<EndTime);
To test it out:
t=-1:0.1:5;
y=f(t,0.3,3.6,1.3);
plot(t,y);grid on;
6 个评论
Sarah
2011-11-11
Fangjun Jiang
2011-11-11
I guess I need your clarification. What are Time.Start and Time.End, the start/end time of your signal or the square? What is the "square function" that you are looking for? PWM?
Sarah
2011-11-11
Fangjun Jiang
2011-11-11
Okay, then what is the start/end time of the square?
Sarah
2011-11-11
Fangjun Jiang
2011-11-11
In the f() defined in my code, the StartTime and EndTime refer to the start/end time of the square. You can put the start/end time of your signal in the time vector.
t=(0:0.0001:10)*2*pi;
y=f(t,30,50,1.3);
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!