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 commentaire

eliman
eliman le 1 Avr 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]

Connectez-vous pour commenter.

 Réponse acceptée

Paulo Silva
Paulo Silva le 1 Avr 2011

1 vote

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 commentaire

eliman
eliman le 1 Avr 2011
Thanks for the extended answer it was very helpful.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by