How to plot the following function in 3D ?

1 回表示 (過去 30 日間)
Pardis
Pardis 2014 年 3 月 21 日
回答済み: Roger Stafford 2014 年 3 月 21 日
Hello I want to plot f(x,y)=2+0.1(x)+0.008(x+y)^2+sin(x-y)so my code line is
clear x=0:0.2:10; y=0:0.2:10; [xgrid, ygrid]=meshgrid(x,y); z=2+(0.1*xgrid)+0.008*(xgrid+ygrid).^2+sin.*(xgrid-ygrid); mesh(xgrid, ygrid, z) xlabel('x') ylabel('y') title('graph z=2+0.1.*xgrid+0.008.*(xgrid+ygrid).^2+sin.*(xgrid-ygrid')
but i keep getting an error for fifth line saying that not enough input arguments. i don`t understand what i have done wrong . if someone could help me i's be grateful. thanks.

回答 (1 件)

Roger Stafford
Roger Stafford 2014 年 3 月 21 日
In that fifth line you have "sin.*(xgrid-ygrid)" instead of sin(xgrid-ygrid). The compiler can't find an argument for the 'sin' function, hence the error message.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by