Solve numerical equation with Y at both sides
5 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have a general equation I would like to solve. However, it contains the dependent variable Y on both sides.
The eqaution is: Y/Y_0 = B * (1 + x*Y/D)^0.5 * (1-x)^alpha
Where x is the independent variable,
and Y_0, B, D and alpha are constants. What would be the most appropriate function in Matlab for this particular problem?
Thanks,
Ron
0 件のコメント
回答 (3 件)
KSSV
2020 年 8 月 23 日
You can use symbolic package. Something like this:
syms Y_0 Y B x Y D alpha
eqn = Y/Y_0 - B * (1 + x*Y/D)^0.5 * (1-x)^alpha==0 ;
s = solve(eqn,Y)
Star Strider
2020 年 8 月 23 日
A numeric approach:
Y_0 = 3; % Define Constants
B = 5;
D = 7;
alpha = 11;
x = linspace(0, 0.9, 10);
Yfcn = @(Y,x) B * sqrt(1 + x*Y/D) .* (1-x).^alpha - Y/Y_0; % Use Element-Wise Operations
for k = 1:numel(x)
Y(k) = fzero(@(Y)Yfcn(Y,x(k)), 0.1);
end
figure
plot(x, Y)
grid
2 件のコメント
Alan Stevens
2020 年 8 月 23 日
編集済み: Alan Stevens
2020 年 8 月 23 日
Your equation can also be expressed as a quadratic in Y
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/350342/image.jpeg)
which could be solved using roots (for specified values of x).
You would need to check that the solutions were consistent with the original equation.
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!