Hi why am i getting this error?
x = linspace(-1,1,20);
y = linspace(-2,2,40);
z = (1.+sin(pi.*x)).*((3.+cos(1.065.*y)).^2).*exp(-x.^2 -(y.^2)./4);
??? Error using ==> minus
Matrix dimensions must agree.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because
xandyare not the same size. What you likely want to use here ismeshgrid.The code would be something like:
Then you can visualize like:
And get stuff like this: