Azzera filtri
Azzera filtri

Syms and solver help

3 visualizzazioni (ultimi 30 giorni)
Matthew Myers
Matthew Myers il 25 Mar 2021
Commentato: Star Strider il 28 Mar 2021
Hello all,
I am taking a resonant converters class and I am trying to use MATLAB to solve an equation that relates frequency and Load to a duty cycle for a converter I am looking at. I entered my equation below and when I didn't have success getting the solver to work( I am pretty sure that for my Rl min of 5 ohms and the frequency of 400,000Hz, I should get a D = 0.5), I tried to plot it as well, but I didn't succeed in that either. Could anyone help me understand my issues with the solver and also why I can't plot this?
(sorry for not including C before
C = 2.533e-8
f = 400e3;
Rl_min = 5;
syms D
S = double(solve((2*pi*f*C*Rl_min) == 1/(2*pi)*(1-2*pi^2*(1-D)^2-cos(2*pi*D)+(2*pi*(1-D)+sin(2*pi*D))^2/(1-cos(2*pi*D))),D))
y1 = (2*pi*f*C*Rl_min);
y2 = (1/(2*pi)*(1-2*pi^2*(1-D)^2-cos(2*pi*D)+(2*pi*(1-D)+sin(2*pi*D))^2/(1-cos(2*pi*D))));
x = linspace(0,1);
plot(x,y1,x,y2)

Risposta accettata

Star Strider
Star Strider il 26 Mar 2021
Modificato: Star Strider il 26 Mar 2021
The code apparently works (although ‘C’ is missing, and since double does not allow for symbolic variables to be present, ‘S’ will be empty). To see ‘S’ with symbolic variables, use vpa instead of double.
As for the plots, try this:
C = 2.533e-8;
f = 400e3;
Rl_min = 5;
syms D
S = double(solve((2*pi*f*C*Rl_min) == 1/(2*pi)*(1-2*pi^2*(1-D)^2-cos(2*pi*D)+(2*pi*(1-D)+sin(2*pi*D))^2/(1-cos(2*pi*D))),D))
y1 = (2*pi*f*C*Rl_min);
y2 = (1/(2*pi)*(1-2*pi^2*(1-D)^2-cos(2*pi*D)+(2*pi*(1-D)+sin(2*pi*D))^2/(1-cos(2*pi*D))));
x = linspace(0,1);
figure
fplot(y1,[0 1])
hold on
fplot(y2,[0 1])
hold off
set(gca,'YScale','log')
grid
EDIT — (26 Mar 2021 at 00:43)
With the addition of a value for ‘C:
S =
-2.264999999973986e+02
Since ‘S’ does not have a symbolic solution, likely because ‘D’ is also an argument to the trigonometric functions.
The plots change a bit, however the code does not.
  4 Commenti
Matthew Myers
Matthew Myers il 28 Mar 2021
Sorry, I forgot to accept this answer. Thank you for the help Start Strider, I appreciate it!
-Matthew
Star Strider
Star Strider il 28 Mar 2021
As always, my pleasure!
Thank you for returning to Accept it!

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by