# Help with inverse logarithm

조회 수: 11(최근 30일)
Abel Corona 8 Nov 2019
Answered: Abel Corona 8 Nov 2019
I am attempting to solve a problem, but I cannot run my code because of an error. The code below is what I'm trying to run.
% Solve for life using SWT equations for a, b, and c.
Sa = 220; % Stress amplitude in MPa given in problem
Sm = 100; % Given stress as a matlab vector (MPa)
Smax = Sm + Sa; % Calculate maximum stress
b = -0.102; % Correction factor for material
N = ((log(b)\log(10))*((sqrt(Smax*Sa))\Sm))\2; % Lifefor mean stresses using SWT equation
The formula I'm trying to use is down below: Also, I'm trying to figure out how to run the formula multiple times with different inputs of Sm. Such that Sm = 0, 100, and -100.
Any help will be greatly appreciated!

로그인 to comment.

### 채택된 답변

Abel Corona 8 Nov 2019
Figured it out!
% Solve for life using SWT equations for a, b, and c.
Sa = 220; % Stress amplitude in MPa given in problem
Sm = [0 110 -110]; % Given stress as a matlab vector (MPa)
Sf = 900; % MPa
Smax = Sm + Sa; % Calculate maximum stress
b = -0.102; % Correction factor for material
N = (nthroot((sqrt(Smax*Sa)/Sf),b))/2; % Lifefor mean stresses using SWT equation

#### 댓글 수: 0

로그인 to comment.

KSSV 8 Nov 2019
KSSV 님이 편집함. 8 Nov 2019
% Solve for life using SWT equations for a, b, and c.
Sa = 220; % Stress amplitude in MPa given in problem
% Sm = 100; % Given stress as a matlab vector (MPa)
Sm = [0, 100, -100] ;
Smax = Sm + Sa; % Calculate maximum stress
b = -0.102; % Correction factor for material
N = ((log(b)\log(10))*((sqrt(Smax.*Sa)).\Sm))\2; % Lifefor mean stresses using SWT equation

#### 댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

R2019b