Using continous time in Matlab editor

1 次查看(过去 30 天)
In the code below, I need to use continous time to generate phi. I want to achieve this in MATLAB editor. I can do this in Simulink using simulink clock block. I want the time t in the editor's script to emulate the clock's block time. Kindly help.
V1 = 18; % Input voltage
R = 7.2; % Load resistance
a = 0 * (2*pi/360); % pulse shift angle (rad)
fs = 70000; % Switching frequency
phi = pi* ((31*2/360) - (0.028*sin(2*pi*t)))); % Phase shift (pi.d in rad) & t is time

采纳的回答

Walter Roberson
Walter Roberson 2024-2-25
Pi = sym(pi);
syms t
phi = Pi * ((31*2/360) - (0.028*sin(2*Pi*t))) % Phase shift (pi.d in rad) & t is time
phi = 
phi is expressed in continuous time t
I have to wonder whether your actual equation is
phi = Pi * ((31*2/360)) - (0.028*sin(2*Pi*t))
phi = 
fplot(phi, [0 10])

更多回答(2 个)

Alexander
Alexander 2024-2-25
Maybe something simple like that:
V1 = 18; % Input voltage
R = 7.2; % Load resistance
t = 0:0.001:3*pi;
a = 0 * (2*pi/360); % pulse shift angle (rad)
fs = 70000; % Switching frequency
phi = pi* ((31*2/360) - (0.028*sin(2*pi*t))); % Phase shift (pi.d in rad) & t is time
plot(t,phi)
  3 个评论
Alexander
Alexander 2024-2-25
编辑:Alexander 2024-2-25
Yes of cause. It depends of what you are expecting.
Alexander
Alexander 2024-2-25
If forgotten a remark. If fs is the sample frequency just replace 0.001 by 1/70000.

请先登录,再进行评论。


Olutayo Omotoso
Olutayo Omotoso 2024-2-28
Thanks you all for your help

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by