简体   繁体   中英

Matlab: Plotting the conditions output of symbolic solve

I have a loop where I symbolically solve for intervals. Each iteration of the loop gives exactly one interval, for example:


v=[x+1,-x+4];

v = v > 0;

sol=solve(v,x,'ReturnConditions',true);
cond = sol.conditions;

ezplot(cond)

Would I be able to plot the 1x1 symbolic array " cond = -1 < x & x < 4 " at ay value of my choosing? When I use ezplot it always plots at y=1.

Maybe by multiplying the cond by the y value you wish to use. In that case the title must be changed to match the original condition, cond by casting it as a string. In the example below I plotted the condition/region at a height of y = 2 . To implement this in the for-loop I'd probably make a y a vector a retrieve one value/cell upon each iteration.

以特定幅度绘制的条件

syms x
v = [x+1,-x+4];
v = v > 0;

sol = solve(v,x,'ReturnConditions',true);
cond = sol.conditions;

y = 2;
ezplot(y*cond);
ylim([0 y*1.2]);
title(string(cond));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM