how to write exponential equations in matlab
古いコメントを表示
I want to write this equation in matlab
and calculate values for this equation buy giving input values for x(1,0)
4 件のコメント
Image Analyst
2023 年 4 月 30 日
You won't learn much if we just give you the equation. To learn such fundamental concepts, invest 2 hours of your time here:
Hint: e to the x power is exp(x). You should be able to do it now.
Muthumari
2023 年 4 月 30 日
You must call the function "grad" with a numerical input for x to get a reasonable output:
g = grad([1 1])
function g = grad(x)
g(1,1) = 2+4*x(1)*exp(2*x(1)^2+x(2)^2);
g(2,1) = 6*x(2)+2*x(2)*exp(x(2)^2+2*x(1)^2);
end
Walter Roberson
2023 年 4 月 30 日
編集済み: Walter Roberson
2023 年 4 月 30 日
syms x [1 2]
g = grad(x)
solution = solve(g)
fimplicit(g, [-1 1])
function g = grad(x)
g(1,1) = 2+4*x(1)*exp(2*x(1)^2+x(2)^2);
g(2,1) = 6*x(2)+2*x(2)*exp(x(2)^2+2*x(1)^2);
end
回答 (1 件)
This works:
x = [0.3, 0.4]; % [x1, x2]
g = MyFunction(x)
function g = MyFunction(x)
g(1) = 2+4*x(1)*exp(2*x(1)^2+x(2)^2);
g(2) = 6*x(2)+2*x(2)*exp(x(2)^2+2*x(1)^2);
end
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


