Plotting with Symbolic Toolbox

Hi all.
I defined two functions F = 2*p + 1 and G = -2*p + 1. I'd like to plot both F and G but also in the same graph a third function H defined as H = min{F,G}. At this point, as a SymbTB newbie I can't figure out how to do so. any idea would be appreciated. Thanx in advance.

回答 (1 件)

Sean de Wolski
Sean de Wolski 2013 年 2 月 20 日

0 投票

One way:
syms p
F = 2*p + 1;
G = -2*p + 1;
figure;axes;hold on
lims = [-50, 50];
fplot(@(x)subs(F,p,x),lims,'b')
fplot(@(x)subs(G,p,x),lims,'r')
fplot(@(x)min(subs(F,p,x),subs(G,p,x)),lims,'g')
Of course you could always pull the symolic part out of this completely...

カテゴリ

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

タグ

質問済み:

2013 年 2 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by