フィルターのクリア

How to solve many equations at once? (Not a system but just multiple separate equations)

4 ビュー (過去 30 日間)
atharva aalok
atharva aalok 2021 年 9 月 16 日
回答済み: KSSV 2021 年 9 月 16 日
I have a vector of equations in symbollic form instead of using a for loop to solve I want to solve them all at once for speed.
PmSol = linspace(0, .5, 1000);
% after some code in between...
syms x Pm
assume(x, 'real');
eqn1 = 0.5*(x+1)*((1-x*x)^(0.5)) == Pm;
Pm_val = PmSol;
% get different equations for each value of the parameter Pm
eqn = subs(eqn1, Pm, Pm_val);
% the above gives a column of 1000 equations
% The Problem: I want to solve each equation and get the corresponding
% solutions in general I know already that for Pm in this range there will
% be 2 solutions for each equation.
% This does NOT work
solns = solve(eqn, x);
disp(solns);
I want to solve this very quickly. Do not want to use a for loop. How do vectorize the solve operation.

採用された回答

KSSV
KSSV 2021 年 9 月 16 日
You get the solution for x in terms of Pm first. This will be a symolic xpression. In that you can substiture your Pm values to get x.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by