How to graph my for loop?

3 ビュー (過去 30 日間)
Caleb Hedin
Caleb Hedin 2020 年 11 月 18 日
編集済み: Geoff Hayes 2020 年 11 月 18 日
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)

採用された回答

Walter Roberson
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 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by