why does the command window show 'Unrecognized function or variable 'beta_est'.'? how to solve it?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Haotian Wang
el 5 de Mayo de 2021
syms bets_est;
for t=1:n-1;
func=(sigma2(t+1)-sigma2(t))/(S(t+1)-S(t))*S(t)/sigma2(t)==beta_est(t)-2;
end
solve(eq,beta_est);
where sigma2 is an anrray with 1*809, S is an anrray with 1*809,n=809.
I would like to solve this equation. And here is what the command window shows.
>> for t=1:n-1;
func=(sigma2(t+1)-sigma2(t))/(S(t+1)-S(t))*S(t)/sigma2(t)==beta_est(t)-2;
end
Unrecognized function or variable 'beta_est'.
0 comentarios
Respuesta aceptada
KSSV
el 5 de Mayo de 2021
Editada: KSSV
el 5 de Mayo de 2021
Replace the line:
syms bets_est;
with
syms beta_est;
By the way you need not to use syms.
You can straight away solve using:
beta_est(t) = (sigma2(t+1)-sigma2(t))/(S(t+1)-S(t))*S(t)/sigma2(t) +2;
No loop needed... use
beta_est = diff(sigma2)./(diff(S)).*S(1:end-1)./sigma2(1:end-1) +2;
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Conversion Between Symbolic and Numeric 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!