Define a variable from an equation
23 次查看(过去 30 天)
显示 更早的评论
Hi,
I have an equation with x and y are variable and a, b and d are constant.
with x =[1:1:10];
How to define y variable?
采纳的回答
Walter Roberson
2016-11-21
As I posted in your earlier question,
y1 = @(b, d, x) -b .* (exp(-(2/3) .* lambertw(-3 .* (b.^3 ./ a.^2).^(1/2) .* d.^3 ./ x.^3)) .* d.^2 - x.^2) ./ x.^2
y2 = @(b, d, x) -b .* (exp(-(2/3) .* lambertw(3 .* (b.^3 ./ a.^2).^(1/2) .* d.^3 ./ x.^3)) .* d.^2 - x.^2) ./ x.^2;
Now use y1(b, d, 1:10) and y2(b, d, 1:10)
Note: you will need the Symbolic Toolbox for lambertw, but see also https://www.mathworks.com/matlabcentral/fileexchange/43419-the-lambert-w-function
3 个评论
Walter Roberson
2016-11-21
Symbolic toolbox with x symbolic, and solve() . You can then matlabFunction() and pass the numeric x values in .
The y1 and y2 are there because there are two solutions.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!