gridmesh does not work for my case, why?

2 views (last 30 days)
omer rustu
omer rustu on 3 Jun 2023
Answered: Dyuman Joshi on 3 Jun 2023
having u and v arrays of different sizes (54x1 and 61x1), I attempted to run the following;
function F = fcn(u,v)
[U,V]=meshgrid(u,v);
F= 1/((U.^(-0.66667))+(V.^(-0.6667)));
G=F.^(3/2);
surf(U,V,G)
3rd row did not work and says the following; "matrix dimensions must agree" ?!
what did I make wrong?

Answers (1)

Dyuman Joshi
Dyuman Joshi on 3 Jun 2023
You need to use element-wise division as well in defining F
u = rand(54,1);
v = rand(61,1);
[U,V]=meshgrid(u,v);
% v
F= 1./((U.^(-0.66667))+(V.^(-0.6667)));
G=F.^(3/2);
surf(U,V,G)

Tags

Community Treasure Hunt

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

Start Hunting!