How to plot these function plesa help

8 ビュー (過去 30 日間)
Joe Gani
Joe Gani 2015 年 6 月 17 日
コメント済み: Joe Gani 2015 年 6 月 17 日
Hello.
I tried almost everything, but with no succsess. Maybe anyone knows and can share matlab code to plot these function: f(x) = (4 - 2.1*x1^2 + x1^4/3)*x1^2 + x1*x2 + (-4 + 4*x2^2)*x2^2
Thank you

採用された回答

Mischa Kim
Mischa Kim 2015 年 6 月 17 日
Joe, you could use
[x1,x2] = meshgrid(0:0.5:10,0:0.5:10);
f = (4 - 2.1*x1.^2 + x1.^4/3).*x1.^2 + x1.*x2 + (-4 + 4*x2.^2).*x2.^2;
surf(x1,x2,f)
  5 件のコメント
Walter Roberson
Walter Roberson 2015 年 6 月 17 日
The function has x1^(4/3) . When x1 is negative, the result is complex.
Note that x1^(4/3) is not the same thing as (x1^4)^(1/3) and is potentially different again from (x1^(1/3))^4; just as x1^(1/2) is not the same as (x1^2)^(1/4) . Taking a number to a fractional power requires choosing one root, not hunting through the integer multiples of the exponent to find one that will make the root real-valued.
Perhaps you want,
f = (4 - 2.1*x1.^2 + (x1.^4).^(1/3)).*x1.^2 + x1.*x2 + (-4 + 4*x2.^2).*x2.^2;
but be aware that might not match the formula on the paper.
Joe Gani
Joe Gani 2015 年 6 月 17 日
if helps the function in matlab code is:
y = (4-2.1.*x1.^2+x1.^4./3).*x1.^2+x1.*x2+(-4+4.*x2.^2).*x2.^2;

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by