replacing symbolic coefficient in matrix with numeric one
Show older comments
syms s td a zf wf w
N =s^6*td^2 + 2*zf*s^5*td^2*wf + a*s^5*td^2 + 6*s^5*td + s^4*td^2*wf^2 + 2*a*zf*s^4*td^2*wf + s^4*td^2*wn^2 - k1*k2*s^4*td^2 + 12*zf*s^4*td*wf + 6*a*s^4*td + 12*s^4 + a*s^3*td^2*wf^2 + 2*zf*s^3*td^2*wf*wn^2 + 6*s^3*td*wf^2 + 12*a*zf*s^3*td*wf + 6*s^3*td*wn^2 + 6*k1*k2*s^3*td + 24*zf*s^3*wf + 12*a*s^3 + s^2*td^2*wf^2*wn^2 + 6*a*s^2*td*wf^2 + 12*zf*s^2*td*wf*wn^2 + 12*s^2*wf^2 + 24*a*zf*s^2*wf + 12*s^2*wn^2 - 12*k1*k2*s^2 + 6*s*td*wf^2*wn^2 + 12*a*s*wf^2 + 24*zf*s*wf*wn^2 + 12*wf^2*wn^2;
c=coeffs(N,s)
c=[ 12*wf^2*wn^2, 6*td*wf^2*wn^2 + 12*a*wf^2 + 24*zf*wf*wn^2, td^2*wf^2*wn^2 + 6*a*td*wf^2 + 12*zf*td*wf*wn^2 + 12*wf^2 + 24*a*zf*wf + 12*wn^2 - 12*k1*k2, a*td^2*wf^2 + 2*zf*td^2*wf*wn^2 + 6*td*wf^2 + 12*a*zf*td*wf + 6*td*wn^2 + 6*k1*k2*td + 24*zf*wf + 12*a, td^2*wf^2 + 2*a*zf*td^2*wf + td^2*wn^2 - k1*k2*td^2 + 12*zf*td*wf + 6*a*td + 12, 6*td + a*td^2 + 2*td^2*wf*zf, td^2]
a=-0.01;
wn=3.06309;
k1=0.5;
k2=-1;
td=0.1;
wf=3.43;
zf=0.175;
now form the code, I want to replace the coefficient of c with the numerical values.
2 Comments
Walter Roberson
on 12 Jul 2019
Joy Mondal comments to Torsten:
thanks
Answers (0)
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!