Using continous time in Matlab editor
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (2)
Alexander
el 25 de Feb. de 2024
0 votos
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 comentarios
Walter Roberson
el 25 de Feb. de 2024
t = 0:0.001:3*pi;
That is discrete time, not continuous time.
Alexander
el 25 de Feb. de 2024
If forgotten a remark. If fs is the sample frequency just replace 0.001 by 1/70000.
Olutayo Omotoso
el 28 de Feb. de 2024
0 votos
Categorías
Más información sobre Classical Control Design en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
