While running this program I got the error "Error using mesh (line 71) Data dimensions must agree"
7 views (last 30 days)
Show older comments
f=1000;
s=300;
theta= 45;
dp=0.000005;
rb=35;
Rt=20;
Rmj=18;
Rmn=9;
v1=0.4999;
v2=0.05;
E1=50;
E2=137000;
t=0:0.1:30*pi;
D=((1-v1^2)/E1)+((1-v2^2)/E2);
A=(1/Rt)+(1/Rmj);
B=(1/Rt)+(1/Rmn);
RE=((A*B)*((A+B)/2))^(-1/3);
k=1.0339*(B/A)^0.636;
e=1.003+0.5968*(A/B);
a=((3*e*f*RE*D*k^2)/pi)^(1/3);
b=((3*e*f*RE*D)/pi*k)^(1/3);
pm=1/pi.*((6*f*(1/D)^2)/RE)^(1/3);
x=1:1:10;
y=1:1:10;
[x,y]=meshgrid(x,y);
Pr=pm*sqrt(1-(x/a).^2-(y/b).^2);
Pr=abs(Pr)
v=(pi*s/30)*sqrt((y.*cot(theta)-(rb-dp)).^2*(sin(theta))^2+(x.^2*(cos(theta))^2));
[v,Pr]=meshgrid(v,Pr);
mrr=v.*Pr;
mesh(x,y,mrr)
0 Comments
Answers (1)
Walter Roberson
on 18 Apr 2021
f=1000;
s=300;
theta= 45;
dp=0.000005;
rb=35;
Rt=20;
Rmj=18;
Rmn=9;
v1=0.4999;
v2=0.05;
E1=50;
E2=137000;
t=0:0.1:30*pi;
D=((1-v1^2)/E1)+((1-v2^2)/E2);
A=(1/Rt)+(1/Rmj);
B=(1/Rt)+(1/Rmn);
RE=((A*B)*((A+B)/2))^(-1/3);
k=1.0339*(B/A)^0.636;
e=1.003+0.5968*(A/B);
a=((3*e*f*RE*D*k^2)/pi)^(1/3);
b=((3*e*f*RE*D)/pi*k)^(1/3);
pm=1/pi.*((6*f*(1/D)^2)/RE)^(1/3);
x=1:1:10;
y=1:1:10;
[x,y]=meshgrid(x,y);
Pr=pm*sqrt(1-(x/a).^2-(y/b).^2);
Pr=abs(Pr);
size(Pr)
v=(pi*s/30)*sqrt((y.*cot(theta)-(rb-dp)).^2*(sin(theta))^2+(x.^2*(cos(theta))^2));
[v,Pr]=meshgrid(v,Pr);
mrr=v.*Pr;
size(x), size(y), size(mrr), size(Pr)
mesh(x,y,mrr)
Why are you taking an existing 10 x 10 array, Pr, and using it in meshgrid() to create a 100 x 100 array?
What output size are you expecting?
I would point out that when you assign a variable to have a different purpose, and it is not just a simple loop control variable, then you confuse people trying to read your code. I would therefore recommend that if your Pr is input to meshgrid() that your output should be some other variable name.
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!