How to graph my for loop?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello all As the title states I'm having trouble graphing my for loop, it should be simple but I'm having a hard time plotting the solution. Any help is greatly appreciated, thanks!
%ME 383 Lower Handle Cycles
clc
clear all
k_f = 1; %Miscelaneous-effects factor
z_a = 2.236%Found in table A-10 and table 6-5
k_e = 1-0.08*z_a %Reliability factor
k_d = 1 %Temperature factor table 6-4
k_c = 1 %loading factor table figure 6-26 page 290
d = 3/4 %diameter in inches
k_b = .879*d^(-0.178)
a = 24.4 %table 6-2
b = -0.178 %table 6-2
S_ut = 43 %table A-20
k_a = a*S_ut^(b) %surface factor
Sp_e = 0.5*S_ut
S_e = k_a*k_b*k_c*k_d*k_e*k_f*Sp_e
N = 1 ;%estimated number of cycles
while N<10^5
N = N+100
S_f = a*N^b
end
plot(S_f, N)
댓글 수: 0
채택된 답변
Walter Roberson
2020년 11월 18일
편집: Walter Roberson
2020년 11월 18일
t = 1;
N(t) = 1 ;%estimated number of cycles
while N(t)<10^5
N(t+1) = N(t)+100;
S_f(t+1) = a*N(t+1)^b;
t = t+1;
end
plot(N(2:t), S_f(2:t))
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!