i want write the next function by matlab ?

조회 수: 1 (최근 30일)
mohammed elmenshawy
mohammed elmenshawy 2016년 12월 22일
답변: Walter Roberson 2016년 12월 22일
  댓글 수: 2
John D'Errico
John D'Errico 2016년 12월 22일
It is time for you to learn to use loops. Here a for loop is simple and reasonable.
mohammed elmenshawy
mohammed elmenshawy 2016년 12월 22일
i write the following and displayed the error
. what to do ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 12월 22일
You syms Z but what is z (lower-case) ? Is it a function or is it a vector?
It is not possible to use a symbolic expression to index an array. If you have a finite vector to sum symbolically, then construct all elements of the vector and then sum() them. Constructing the elements of the vector is sometimes possible using vectorization.
t = 4:n;
L = sum((z(t) - null1 .* z(t-1) - null2 .* z(t-2) + theta .* alpha(t-1)).^2) ./ (2 .* sigma.^2);

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by