I just want to plot the function h(x,y)=(xsin(20y)+ysin(20x))^2cosh(sin(10x)x)+(xcos(10y)−ysin(10x))^2cosh(cos(20y)y) and I have the code
clear;
close all;
h=inline('(x*sin(20*y)+y*sin(20*x)).^2*cosh(sin(10*x)*x)+(x*cos(10*y)-y*sin(10*x)).^2*cosh(cos(20*y)*y)','x','y');
x=-3:0.01:3;
y=-3:0.01:3;
for i=1:length(x)
z(:,i)=h(x(i),y);
end
figure(1);
mesh(x,y,z);
xlabel('x','fontsize',14);
ylabel('y','fontsize',14);
zlabel('h(x,y)','fontsize',14);
Why it always gives the response:
Error using inlineeval (line 14) Error in inline expression ==> (x*sin(20*y)+y*sin(20*x)).^2*cosh(sin(10*x)x)+(xcos(10*y)-y*sin(10*x)).^2*cosh(cos(20*y)*y) Inner matrix dimensions must agree.
Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in hw7_2 (line 8) z(:,i)=h(x(i),y);
This is why? Any help will be appreciated! Thanks in advance!
Inner matrix dimensions must agree.
. Matlab error messages are very useful, always read them! – David