Plotting a piecewise symbolic expression in MATLAB using ezplot -


i have created following symbolic integral:

syms x;  syms t;  int(1./((1-t.*x).^3),t,0,1)  ans =     piecewise([x = 1, inf], [not 1/x in (0, 1) , x 1, -(x/2 - 1)/(x - 1)^2]) 

which results in piecewise function definition. want plot integral using ezplot function, leads error:

error using ezplot (line 162) piecewise([1/x in dom::interval([0], [1]), -int(1/(t*x - 1)^3, t, 0, 1)],     [~1/x in dom::interval([0], [1]), -(x - 2)/(2*(x - 1)^2)])     cannot plotted in xy-plane.  error in sym/ezplot (line 61)    h = ezplot(fhandle(f)); 

how can plot piecewise symbolic integral?

though not find evidence mathworks, seems ezplot not work piecewise symbolic functions (source: there few open questions on topic in matlab forum).

in answer presenting work-around, works explicit, invertible functions, i.e. fail stuff x^2 + y^2 = 1 or y^2 = y^4 , , similar stuff. in special case (which assume used often), 1 can manually generate x-vector , calculate corresponding y-values using subs function.

the default range ezplot [-2pi, 2pi]. number of points depends on function, around 1000 points, reasonably smooth plot should created. note: should produce default ezplot behavior. if have further knowledge function, i.e. value ranges etc., should use create x vector.

xp = -2*pi : 0.01: 2*pi; yp = subs(f, x, xp); plot(xp,yp); 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -