How to graph my for loop?
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 18 Nov 2020
Edited: Walter Roberson
on 18 Nov 2020
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 Comments
More Answers (0)
See Also
Categories
Find more on Graph and Network Algorithms 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!