I am not getting the plot for thr following code.Can anyone please identify the mistake?
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
r=0.6;
P=82.7*10.^6;
a=150*10.^-6;
W=pi*a*2*P;
v=0.3;
for h = [1*10.^-6,4*10.^-6];
stress=(3*W*v)/(4*pi*h.^2);
end
plot(h,stress)
댓글 수: 0
답변 (1개)
Star Strider
2016년 3월 1일
편집: Star Strider
2016년 3월 1일
You need to index ‘h’ and ‘stress’, but it’s easiest to forget the loop and just vectorise it:
r=0.6;
P=82.7*1E^6;
a=150*1E-6;
W=pi*a*2*P;
v=0.3;
h = [1*1E-6,4*10E-6];
stress=(3*W.*v)./(4*pi*h.^2);
plot(h,stress)
You probably want to use the linspace function to define ‘h’:
r=0.6;
P=82.7*1E-6;
a=150*1E-6;
W=pi*a*2*P;
v=0.3;
% h = [1*1E-6,4*1E-6];
h = linspace(1*1E-6,4*1E-6);
stress=(3*W.*v)./(4*pi*h.^2);
plot(h,stress)
댓글 수: 2
Daniel M
2016년 3월 1일
Star Strider
2016년 3월 1일
Yes. The formula is not really changed, simply made compatible with vector variables.
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!