write a function about ' v(t)=10^9+10^8*(1-exp(-t./100))-1.5*10^7*t '
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
[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'.
0 commentaires
Réponses (3)
Walter Roberson
le 15 Nov 2011
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 commentaires
Walter Roberson
le 15 Nov 2011
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
le 15 Nov 2011
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
le 15 Nov 2011
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)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!