Data dimensions must agree. Using surf

3 views (last 30 days)
I want to make a 3D plot using MATLAB with the code below:
[pA, T] = meshgrid(7600000:100000:20000000, 313:1:373);
mu = ((((-0.1146067)+(0.000000697838).*(pA/100000)+(0.0000000003976765).*((pA/100000).^2)+(0.0633612).*log(T)+(-0.01166119).*(log(T).^2)+(0.0007142596).*(log(T).^3))/(1+(0.000006519333).*(pA/100000)+(-0.3567559).*log(T)+(0.03180473).*(log(T).^2)))/1000);
surf(pA, T, mu);
colormap(jet); % change color map
shading flat % interpolate colors across lines and faces
colorbar;
pA and T are 61x125 matrices and mu is 61x61. Is there a possibility to equalize this so that I can make the surface plot? Or is there another way to make a 3D plot with these matrices?

Accepted Answer

Walter Roberson
Walter Roberson on 9 Aug 2022
[pA, T] = meshgrid(7600000:100000:20000000, 313:1:373);
mu = ((((-0.1146067)+(0.000000697838).*(pA/100000)+(0.0000000003976765).*((pA/100000).^2)+(0.0633612).*log(T)+(-0.01166119).*(log(T).^2)+(0.0007142596).*(log(T).^3)) ./ (1+(0.000006519333).*(pA/100000)+(-0.3567559).*log(T)+(0.03180473).*(log(T).^2)))/1000);
surf(pA, T, mu);
colormap(jet); % change color map
shading flat % interpolate colors across lines and faces
colorbar;
You accidentally used / where you needed ./
  1 Comment
Olaf Schipper
Olaf Schipper on 9 Aug 2022
That was indeed the problem. Thank you very much!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!