How to find a Y value of a given X?
84 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rishab Vadvadgi
el 17 de Sept. de 2020
Comentada: Star Strider
el 17 de Sept. de 2020
Hello, this is a very simple question. I am writing an equation for v given t:
t = 0:0.00001:0.01;
v= 50*exp(-1600*t) - 50*exp(-400*t);
How would I find the value of v at a certain t? I want to find what v is when t=0.000625.
0 comentarios
Respuesta aceptada
Star Strider
el 17 de Sept. de 2020
This is easiest if you create ‘v’ as an anonymous function:
t = 0:0.00001:0.01;
v = @(t) 50*exp(-1600*t) - 50*exp(-400*t);
ti = 0.000625;
Out = v(ti)
figure
plot(t, v(t))
hold on
plot(ti, v(ti), 'r+')
hold off
grid
3 comentarios
Star Strider
el 17 de Sept. de 2020
My pleasure!
To calculate with functions, it is necessary to evaluate them to do the calculation:
p = @(t) v(t).*i(t);
That works. Note also the use of element-wise multiplication, .* instead of * .
Example —
figure
plot(t, p(t))
grid
.
Más respuestas (2)
Johannes Fischer
el 17 de Sept. de 2020
So in your case:
% define the anonymous function
v = @(t) 50*exp(-1600*t) - 50*exp(-400*t);
% call it
v(0.000625)
1 comentario
Rishab Vadvadgi
el 17 de Sept. de 2020
Editada: Rishab Vadvadgi
el 17 de Sept. de 2020
BOB MATHEW SYJI
el 17 de Sept. de 2020
Hope this helps. x is the input and sol is the value of v at x (in this case x=0.000625)
syms v(t)
x=0.000625;
v(t)= 50*exp(-1600*t) - 50*exp(-400*t);
sol=double(v(x));
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!