I am getting the error as "Error using * Inner matrix dimensions must agree. Error in O1 (line 8) stress=((3*W*v)/(4*pi*h*h));" for the following code.Please help me out
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
r=0.6; P=82.7*1E-6; a=150*1E-6; W=pi*a*2*P; v=0.3; h = linspace(1*1E-6,4*1E-6); stress=((3*W*v)/(4*pi*h*h)); plot(h,stress)
Risposte (2)
JAYESH RAVAL
il 1 Mar 2016
Please try for loop to do calculation
r=0.6;
P=82.7*1E-6;
a=150*1E-6;
W=pi*a*2*P;
v=0.3;
h = linspace(1*1E-6,4*1E-6);
for i=1:length(h)
stress(i)=((3*W*v)/(4*pi*h(i)*h(i)));
end
plot(h,stress)
Star Strider
il 1 Mar 2016
0 voti
You need to use the dot operator with the right division (./) as I showed you in your previous Question http://www.mathworks.com/matlabcentral/answers/270715-i-am-not-getting-the-plot-for-thr-following-code-can-anyone-please-identify-the-mistake.
That code works and produces the correct plot.
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!