write a function about ' v(t)=10^9+​10^8*(1-ex​p(-t./100)​)-1.5*10^7​*t '

1 次查看(过去 30 天)
[EDIT: 20111115 14:07 CST - merge duplicate - WDR]
question about matlab : I want to write a function about ' v(t)=10^9+10^8*(1-exp(-t./100))-1.5*10^7*t ' . In order to get each 't' , how can I write a function with 't' at the left side of the equal sign?(for example:t=......) Thanks for help!!
[Merge from duplicate]
I want to write a function about
v(t)=10^9+10^8*(1-exp(-t./100))-1.5*10^7*t
In order to get each 't' , how can I write a function with 't' at the left side of the equal sign?(for example : t = ......)
v(t)=10^9*(x./100)
x=(100:-5:40)
If I don't write a function with 't' at the left side of the equal sign, but I still have to write a to acquire each 't'.

回答(3 个)

Walter Roberson
Walter Roberson 2011-11-15
If you have a particular v value and wish to solve for the corresponding t value, then the solution is
t = 100*LambertW(-(1/15)*exp((1/1500000000)*v-11/15))-(1/15000000)*v+220/3
LambertW is part of the Symbolic Toolbox, or you can use one of the contributions such as http://www.mathworks.com/matlabcentral/fx_files/6909/1/content/doc/lambertw.html
  3 个评论
Walter Roberson
Walter Roberson 2011-11-15
The solution for your rephrased question remains the same. At best the additional information tells you what value of v to use in the LambertW expression.
If you have the Symbolic Toolkit, the way to get this solution is:
syms v t
tsol = solve(10^9+10^8*(1-exp(-t./100))-3/2*10^7*t,t);
After that if you want to put in particular v, you can do that using subs(), such as
x=100:-5:40;
tnumeric = double( subs(tsol, v, 10^9*(x./100)) );
Myself, I find it difficult to understand how you can define v(t) in terms that do not involve t but do involve a previously unstated variable x.

请先登录,再进行评论。


Daniel Shub
Daniel Shub 2011-11-15
I don't think you can. If you work through the math, I think you will eventually get something t+a*log(b*t) is equal to c. If you are willing to accept the approximation that t+a*log(b*t) is approximately t (for large enough t), then you can isolate t on the LHS.

Friedrich
Friedrich 2011-11-15
Hi,
risky (violates some basic rules of numerical mathematics) but should work in the most cases
func = @(t) 10^9+10^8*(1-exp(-t./100))-1.5*10^7*t;
x0 = 0;
v = 3000;
t = fzero(@(x) func(x) - v,x0)
func(t)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by