How to solve transfer function inside summation?
3 views (last 30 days)
Show older comments
I tried this method:
kr=600;
kp=9;
s=tf('s');
Gc_r= (0.866*s - n*50*pi)/((s^2) + 6*s + (n*100*pi)^2 );
sol= subs(Gc_r, n, 1:2:9);
f=sum(sol)
r_term=f*kr
Gc=kp+r_term
But, it is giving this error : Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To
perform elementwise matrix powers, use '.^'.
I corrected above mentioned error but it didn't work.
error : Undefined operator '.^' for input arguments of type 'tf'.
__________________________________________________________
I also tried this method:
kr=600;
kp=9;
syms s n
Gc_r= (0.866*s - n*50*pi)/((s^2) + 6*s + (n*100*pi)^2 );
sol= subs(Gc_r, n, 1:2:9);
f=sum(sol)
r_term=f*kr
Gc=kp+r_term
It didn't simplified answer either. returned in the form of sum of products.
0 Comments
Accepted Answer
Walter Roberson
on 4 Nov 2020
Symbolic variables do not mix with tf. You cannot use subs() with a tf
You need to use your second approach. Then
[N, D] = numdem(Gc);
collect(N,s) / D
or just
collect(Gc, s)
which will collect the denominator too when the first approach leaves it factored.
4 Comments
Walter Roberson
on 4 Nov 2020
kr=600;
kp=9;
s=tf('s');
n = 1;
f = (0.866*s - n*50*pi)/((s^2) + 6*s + (n*100*pi).^2 );
for n = 3:2:9
f = f + (0.866*s - n*50*pi)/((s^2) + 6*s + (n*100*pi).^2 );
end
r_term = f*kr;
Gc = kp+r_term;
Gc
Paul
on 5 Nov 2020
Though it may not matter for this particular example, you should consider using ss objects instead of tf objects for this type of computation.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!