Transfer function

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 Comment

eliman
eliman on 1 Apr 2011
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]

Sign in to comment.

 Accepted Answer

Paulo Silva
Paulo Silva on 1 Apr 2011
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 Comment

eliman
eliman on 1 Apr 2011
Thanks for the extended answer it was very helpful.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!