I am new to matlab'plz help me, I am trying to get a Transfer function v2/y, when i tried getting v1/y it worked, here it is: syms s ,'a','b','c','d','k'; S = solve('y=v1*(c+d+a)-v2*c','c*(s*v1-s*v2)=b*s*v2+k*v2'); S = [S.v1 /S.y] but when i try to substitute v1 for v2(in the last line) i get the an error. why as that? is there any better way of doing it? tnx.

댓글 수: 1

eliman
eliman 2011년 4월 1일
Here it is again
syms s ,'a','b','c','d','k';
S = solve('y=v1*(c+d+a)-v2*c','c*(s*v1-s*v2)=b*s*v2+k*v2');
S = [S.v1 /S.y]

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

 채택된 답변

Paulo Silva
Paulo Silva 2011년 4월 1일

1 개 추천

S =
v1: [1x1 sym]
y: [1x1 sym]
There no v2 in the solution so S.v2 gives the error
If you want S.v2
syms s a b c d k
S = solve('y=v1*(c+d+a)-v2*c','c*(s*v1-s*v2)=b*s*v2+k*v2','v2','y');
S = [S.v2 /S.y]
Please note that the way you were defining the symbolic variables was working fine but could be simpler like in my code.
Also note that I added 'v2' and 'y' to the solve function, this way I'm telling that I want to get the solution for the v2 and y variables, if you don't specify the variables the solver will find them for you just like in your code, but it might not give what you wanted.

댓글 수: 1

eliman
eliman 2011년 4월 1일
Thanks for the extended answer it was very helpful.

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

추가 답변 (0개)

카테고리

질문:

2011년 4월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by