I have 20 values of lambda and 16 values of t and a matrix of size 15x16 how can I find exp(-lambda*t)*v
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Fatin
el 1 de Oct. de 2014
Comentada: Star Strider
el 2 de Oct. de 2014
lambda=linspace(.1,1.99,20);
t=linspace(0,1,16);
1 comentario
dpb
el 1 de Oct. de 2014
I did it for you this time, but please format the code to be legible--note that two blanks before the first line of a paragraph starts a code section. Look at the format for the posting in the Edit window and compare what happens in the Preview window if you remove one of those, etc., ...
Respuesta aceptada
Star Strider
el 1 de Oct. de 2014
Editada: Star Strider
el 1 de Oct. de 2014
I have no idea what data you are analysing or simulating, so I have no idea what your constraints might be. One option would be to simply specify ‘lambda’ to be 16 rather than 20 values over the same span:
lambda=linspace(.1,1.99,16);
A second option is to extrapolate ‘v’ to also be (20x15):
lv = lambda(1:15);
ve = interp1(lv, v, lambda, 'pchip', 'extrap');
eltv = exp(-lambda'*t).*ve;
figure(2)
plot(t, eltv)
grid
This assumes that ‘v’ is in some way related to ‘lambda’, so the extrapolation takes the first 15 values of ‘lambda’ and uses the full ‘lambda’ vector to extrapolate ‘v’ to ‘ve’. Since ‘lambda’ is linear, it is as good a choice as any. Choose the extrapolation method that is most appropriate for your data among the available options. (I chose 'pchip' for no particular reason. You must choose a method if you want to extrapolate.)
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!