How to plot this implicit function
Afficher commentaires plus anciens
I need a beta vs eps plot of the curve t^2-d. The expression of t and d depends on x, y where x, y depend on beta. Please help. Ranges of beta and eps are both equal to 0:.01:1,
alpha=1.5; A=0.0207; gamma=0.25;
x=@(beta) (beta-alpha*(beta-gamma)+sqrt((beta-alpha*(beta-gamma)).^2+4*alpha*beta*gamma*A))./(2*beta);
y=@(beta) x.*(1-x).*beta/gamma;
t=@(beta,eps) -x+x.*y.*(alpha-eps*beta)./((A+x+y).^2);
d=@(beta,eps) eps*beta.*x.*y.*(x.^2+(A+x).*x+A*alpha)./((A+x+y).^3);
F=@(beta,eps) (t.^2-d);
figure
ezplot(F,[0,1,0,1]);
9 commentaires
darova
le 8 Sep 2019
I don't see here eps
x=@(beta,eps) (beta-alpha*(beta-gamma)+sqrt((beta-alpha*(beta-gamma)).^2+4*alpha*beta*gamma*A))./(2*beta);
What is x? Where is eps?
y=@(beta,eps) x.*(1-x).*beta/gamma;
darova
le 8 Sep 2019
Sorry didn't notice that. You should write input arguments for your function all the time
f1 = @(x,y) x + y;
f2 = @(x,y) f1 + 2*x;
% f2 = @(x,y) f1(x,y) + 2*x; % should be
f2(1,1)
Atom
le 8 Sep 2019
darova
le 8 Sep 2019
x=@(beta) (beta-alpha*(beta-gamma)+sqrt((beta-alpha*(beta-gamma)).^2+4*alpha*beta*gamma*A))./(2*beta);
y=@(beta) x.*(1-x).*beta/gamma;
has to be
x=@(beta) (beta-alpha*(beta-gamma)+sqrt((beta-alpha*(beta-gamma)).^2+4*alpha*beta*gamma*A))./(2*beta);
y=@(beta) x(beta).*(1-x(beta)).*beta/gamma;
darova
le 8 Sep 2019
Vectorizing
Forgot the dot

Why not use .^2?
fun2 = @(beta,eps) t(beta,eps).^2 - d(beta,eps);
Atom
le 8 Sep 2019
darova
le 8 Sep 2019
Works for me

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Calculus dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!