how to plot symbolic equations

Hi,
I was trying to plot symbolic ode equations. my code is
syms r Z_r w_r t i_L
syms n V_in V_o v_c
r=n*V_in-(V_o/2);
i_L=(r/Z_r)*sin(pi-w_r*t);
v_c=n*V_in+r*cos(pi-w_r*t);
y=Z_r*i_L;
fplot(v_c,y)
but it is giving me this error
Error using fcnchk (line 106)
If FUN is a MATLAB object, it must have an feval method.
Error in fplot (line 62)
fun = fcnchk(fun);
Error in Untitled (line 8)
fplot(v_c,y)
Can anyone please help?

4 件のコメント

safisay
safisay 2017 年 10 月 18 日
編集済み: Walter Roberson 2017 年 10 月 18 日
I have also tried this one but this is also not working
% function P = plot_arc(a,b,h,k,r)
% Plot a circular arc as a pie wedge.
% a is start of arc in radians,
% b is end of arc in radians,
% (h,k) is the center of the circle.
% r is the radius.
% Try this: plot_arc(pi/4,3*pi/4,9,-4,3)
% Author: Matt Fig
syms r Z_r w_r t i_L
syms n V_in V_o v_c v_cr
% t = linspace(a,b);
% x = r*cos(t) + h;
% y = r*sin(t) + k;
% x = [x h x(1)];
% y = [y k y(1)];
h=n*V_in;
k=0;
a=V_o/2-v_cr;
b=V_o/2+v_cr;
t = linspace(a,b);
r=n*V_in-(V_o/2)+v_cr;
i_L=(r/Z_r)*sin(pi-w_r*t);
v_c=n*V_in+r*cos(pi-w_r*t);
v_c = [v_c h v_c(1)];
i_L = [i_L k i_L(1)];
y=i_L*Z_r;
P = fill(v_c,y,'r');
axis([h-r-1 h+r+1 k-r-1 k+r+1])
axis square;
if ~nargout
clear P
end
P = plot_arc(a,b,h,k,r);
set(P,'edgecolor','b','linewidth',4)
KSSV
KSSV 2017 年 10 月 18 日
There are too many symbolic variables....
safisay
safisay 2017 年 10 月 18 日
yes!! I know that..but is it possible to plot with these variables?
Walter Roberson
Walter Roberson 2017 年 10 月 18 日
fplot() does accept pairs of functions, but the functions must only involve one variable. You appear to be using an older MATLAB release; in current releases the error for the first version would be,
Error using fplot>singleFplot (line 236)
Input must be a function or functions of a single variable.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

質問済み:

2017 年 10 月 18 日

編集済み:

2017 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by