MATLAB Answers

LogPlot question in a While loop

34 views (last 30 days)
Caleb Hedin
Caleb Hedin on 5 Dec 2020
Answered: Walter Roberson on 5 Dec 2020
Hello, All
I am trying to understand the logplot commands, here I have a normal plot but I'd like to understand how to make this into a LogPlot, is there a command I can run rather than the "plot" that I have listed?
%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
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))

Answers (1)

Community Treasure Hunt

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

Start Hunting!