필터 지우기
필터 지우기

matlab function

조회 수: 1 (최근 30일)
LIU WEIHUA
LIU WEIHUA 2012년 3월 26일
First I write a function as follow:
syms x y z
f = [x*y*z; y; x + z];
v = [x, y, z];
R = jacobian(f, v);
As just you said, to get the value of R at the particular value of x,y,z, I can use
subs(R,[x,y,z],{1,2,3});
However, if z is a vector, and I want to compute the each value of R by using each element of z and the value of x,y, hence, I made a loop as follow:
%Consider x=1;y=2;z=[1 2 3];
for i = 1:size(z)
t = z(i);
R(:,:,i)=subs(R,[x,y,z],{1,2,t});
end
however, it doesn't work, because t can not be instead by each value in vector z, what shall I do on this?
Thank you very much!
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2012년 3월 26일
Please format your question: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup

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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 3월 27일
syms x y z
f = [x*y*z; y; x + z];
v = [x, y, z];
R = jacobian(f, v);
t = 1:3;
Out = zeros([size(R),numel(t)]);
for j1 = 1:numel(t)
Out(:,:,j1) = subs(R,[x y z],[1 2 t(j1)]);
end
  댓글 수: 1
LIU WEIHUA
LIU WEIHUA 2012년 3월 27일
Thanks very much!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Formula Manipulation and Simplification에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by