フィルターのクリア

Syms and solver help

3 ビュー (過去 30 日間)
Matthew Myers
Matthew Myers 2021 年 3 月 25 日
コメント済み: Star Strider 2021 年 3 月 28 日
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)

採用された回答

Star Strider
Star Strider 2021 年 3 月 26 日
編集済み: Star Strider 2021 年 3 月 26 日
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 件のコメント
Matthew Myers
Matthew Myers 2021 年 3 月 28 日
Sorry, I forgot to accept this answer. Thank you for the help Start Strider, I appreciate it!
-Matthew
Star Strider
Star Strider 2021 年 3 月 28 日
As always, my pleasure!
Thank you for returning to Accept it!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by