Info

This question is closed. Reopen it to edit or answer.

Solve equations and get "t"

1 view (last 30 days)
Redwood
Redwood on 5 Dec 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Dear Matlab experts,
I attached my coding below. When you look at the graph, one "t" exists.
Please let me know how to get "t".
Thank you very much in advance.
Sincerely yours,
J1
t = 0:20;
z = 17267.895;
a = -14.62;
b = -6.19;
c = -9.11;
d = -6.72;
e = -9.19;
f = -12.23;
g = -7.93;
h = -17.56;
aa =34.13;
bb = 1337.71;
cc = 81.78;
dd = 60.48;
ee = 127.45;
ff = 142.39;
gg = 62.27;
hh = 309.33;
i = aa*exp(-t.*a) + bb*exp(-t.*b) + cc*exp(-t.*c) + dd*exp(-t.*d) + ee*exp(-t.*e) + ff*exp(-t.*f) + gg*exp(-t.*g) + hh*exp(-t.*h);
j = (aa*exp(-t.*a))./i;
k = (bb*exp(-t.*b))./i;
l = (cc*exp(-t.*c))./i;
m = (dd*exp(-t.*d))./i;
n = (ee*exp(-t.*e))./i;
o = (ff*exp(-t.*f))./i;
p = (gg*exp(-t.*g))./i;
q = (hh*exp(-t.*h))./i;
jj = z*j;
kk = z*k;
ll = z*l;
mm = z*m;
nn = z*n;
oo = z*o;
pp = z*p;
qq = z*q;
plot(t,jj)
solve('z*(aa*exp(-t.*a))/i == 100','t')

Answers (2)

Torsten
Torsten on 5 Dec 2014
z = 17267.895;
a = -14.62;
b = -6.19;
c = -9.11;
d = -6.72;
e = -9.19;
f = -12.23;
g = -7.93;
h = -17.56;
aa = 34.13;
bb = 1337.71;
cc = 81.78;
dd = 60.48;
ee = 127.45;
ff = 142.39;
gg = 62.27;
hh = 309.33;
funk=@(t)(z*aa*exp(-t*a)/(aa*exp(-t*a) + bb*exp(-t*b) + cc*exp(-t*c) + dd*exp(-t*d) + ee*exp(-t*e) + ff*exp(-t*f) + gg*exp(-t*g) + hh*exp(-t*h))-100);
t0=fzero(funk,[0 20]);
Best wishes
Torsten.
  2 Comments
Redwood
Redwood on 5 Dec 2014
Dear Torsten,
If 100 is 499.14, then I would like to know how to get "t". I got errors in Matlab. Thank you very much.
Sincerely yours,
J1
Torsten
Torsten on 8 Dec 2014
What do you mean by "If 100 is 499.14" ?
What errors did you get when you ran the code I posted ?
Best wishes
Torsten.

Star Strider
Star Strider on 5 Dec 2014
When I run your code, I get a plot of ‘jj’ (a vector) as a function of ‘t’ (a vector). That seems to me to do what you want.
The solution of your equation for ‘t’ requires only a couple lines of relatively simple algebra to produce:
t = -log((100*i)/(z*aa))/a

Community Treasure Hunt

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

Start Hunting!