How can I solve an equation with more than one variable?

1 view (last 30 days)
Hi,
I have constants which are
G=44*10^3;
b=2.95e-10;
tao=0.02;
k=1.38e-23;
delta_fo=0.5;
epsilon_ref=10^6;
q=1.8;
p=0.3;
And also I have these variables
epsilon_p=[0.001,0.01,0.1,1,10]
T=[773,873,973,1073,1173]
My equation is
sigma_t=tao*G*(1-(((k*T)/(delta_fo*G*b^3*log(epsilon_ref/epsilon_p)))^(1/q))^(1/p))
I want to solve this equation for example epsilon_p=0.001 when T=773.
But can't do anything.Hope anyone can help me.

Accepted Answer

Stephan
Stephan on 1 Dec 2020
Edited: Stephan on 1 Dec 2020
You can solve for all cases in one calculation and save teh result as a matrix by using a function handle:
G=44*10^3;
b=2.95e-10;
tao=0.02;
k=1.38e-23;
delta_fo=0.5;
epsilon_ref=10^6;
q=1.8;
p=0.3;
epsilon_p=[0.001,0.01,0.1,1,10]
T=[773,873,973,1073,1173]
sigma_t= @(epsilon_p,T) tao*G*(1-(((k*T')./(delta_fo*G*b^3*log(epsilon_ref./epsilon_p))).^(1/q)).^(1/p))
sol = sigma_t(epsilon_p,T)
result:
sol =
1.0e+09 *
-0.2663 -0.3313 -0.4242 -0.5643 -0.7910
-0.3336 -0.4150 -0.5314 -0.7069 -0.9908
-0.4078 -0.5072 -0.6495 -0.8641 -1.2112
-0.4888 -0.6080 -0.7786 -1.0358 -1.4518
-0.5765 -0.7171 -0.9182 -1.2216 -1.7122
This works because of vectorization - on of the things that make Matlab great. Every row is one value of T and all the values of epsilon. Every column stands for changing T and the correspondig entry in epsilon:
>> Line3 = sigma_t(epsilon_p,T(3))
Line3 =
1.0e+09 *
-0.4078 -0.5072 -0.6495 -0.8641 -1.2112

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!