필터 지우기
필터 지우기

Plotting with If-else statement

조회 수: 2 (최근 30일)
Daryl Chua
Daryl Chua 2019년 10월 21일
Matlab code
im trying to plot but cant properly show it
for i=0:0.1:o4;
if (i<=o1) & (i>=0)
y1=(((Ra/2)*i.^2+(w/6)*i.^3+c1)/(E*I))*1000000;
y2=(((Ra/6)*i.^3+(P1/6)*(i-L1).^3-(w/24)*i.^4+c1*i)/((E*I)/1000.^2));
elseif (i<=o2) & (i>=o3)
y1=(((Ra/2)*i.^2+(P1/2)*(i-L1).^2+(w/6)*i.^3-(w/6)*(i-L1-L2).^3+c1)/(E*I))*1000000;
y2=(((Ra/6)*i.^3+(P1/6)*(i-L1).^3+M/2*(i-(L1+L2)).^2-(w/24)*i.^4+c1*i)/((E*I)/1000.^2));
else (i<=o3)&(i>=o4)
y1=(((Ra/2)*i.^2+(P1/2)*(i-L1).^2+M*(i-(L1+L2))+(P2/2)*(i-L1-L2-L3).^2+(w/6)*i.^3-(w/6)*(i-L1-L2).^3+c1)/(E*I))*1000000;
y2=(((Ra/6)*i.^3+(P1/6)*(i-L1).^3+M/2*(i-(L1+L2)).^2+(P2/6)*(i-L1-L2-L3).^3-(w/24)*i.^4+(w/24)*(i-L1-L2).^4+c1*i)/((E*I)/1000.^2));
end
end
subplot(2,1,2);
plot(i,y1,'b.');
title('Plot of the slope');
subplot(2,1,1);
plot(i,y2,'r.');
title('Plot of the Beam Deflection');

답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by