solve an expression and plot
3 次查看(过去 30 天)
显示 更早的评论
Suppose, for each alpha, I have to find a delta which is the highest positive root of the equation A^2-4*B*beta=0. The expression of A, B are given in terms of alpha and delta. How to get that and how to plot alpha vs delta plot.
beta=0.85;gamma=.15;theta=0.1;
alpha=.303:.001:5
syms delta
A=-alpha*beta + alpha.*delta + gamma*beta + beta;
B=alpha.*theta*(beta -delta) + gamma*beta;
rr=solve(A^2-4*B*beta == 0)
plot(alpha,rr)
0 个评论
采纳的回答
Walter Roberson
2013-6-3
beta = 0.85; gamma = .15; theta = 0.1;
alpha = .303: .001: 5;
syms Alpha delta
A = -Alpha * beta + Alpha .* delta + gamma * beta + beta;
B = Alpha .* theta * (beta - delta) + gamma * beta;
rr = solve( A^2 - 4*B*beta, delta);
rrt = double(subs(rr, Alpha, alpha(1));
[maxrrt, idx] = max(rrt);
maxrr = rr(idx);
rrpos = double(subs(maxrr, Alpha, alpha));
plot(alpha, rrpos)
0 个评论
更多回答(1 个)
Azzi Abdelmalek
2013-6-3
编辑:Azzi Abdelmalek
2013-6-3
beta=0.85;
gamma=.15;
theta=0.1;
alpha=(.303:.001:5)'
syms delta
A=-alpha*beta + alpha*delta + gamma*beta + beta;
B=alpha*theta*(beta -delta) + gamma*beta;
for k=1:numel(A)
rr{k}=solve(A(k).^2-4*B(k)*beta == 0);
end
2 个评论
Walter Roberson
2013-6-3
After which you would need the step of finding the highest positive root for each rr{:}
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!