Bode Plot data extraction to xlsx file format
10 ビュー (過去 30 日間)
古いコメントを表示
The coefficinets a1,a2, b1, b2 k1, k2 are computed using some arithmetic calculations according to some specific requirement. After the computation Bode plot is done for High pass, Notch and Low pass filters. The requirement for me is to obtain the data of the bode plot (corresponding magnitude vs frequency and phase vs freq) in to a csv file or text file.
Bode plot respons is as expected and the problem I am facing for the
xlswrite('data.xlsx', [dat1,dat2,dat3]) command is Input data must be a numeric, cell, or logical array.
Even in the Data Statistics tab the values are displaying as NaN
Can somebody suggest a solution or workaround ?
Code:
%HighPass Filter
Vin=[1 a1 a0];
V01=[0 ((-(k2*b2*a1))+(k2*b1)) ((-k2*b2*a0)+(k2*b0))];
LP=tf(V01,Vin)
opts = bodeoptions;
opts.FreqUnits = 'kHz';
dat1=bodeplot(LP,opts,'r');
hold on
%Notch Filter
Vin=[1,a1,a0];
V02=[b2,b1,b0];
HP=tf(V02,Vin)
opts = bodeoptions;
opts.FreqUnits = 'kHz';
dat2=bodeplot(HP,opts,'b');
hold on
%Low Pass Filter
Vin=[(K1*sqrt(a0)) (a1*(K1*sqrt(a0))) (a0*(K1*sqrt(a0)))];
V03=[0 ((b0-(b2*a0))) ((a1*b0)-(a0*b1))];
BN=tf(V03,Vin)
opts = bodeoptions;
opts.FreqUnits = 'kHz';
dat3=bodeplot(BN,opts,'g');
hold off
0 件のコメント
採用された回答
Star Strider
2019 年 6 月 27 日
It is essentially impossible to get any useful results from bodeplot. It is intended to provide plot options.
Use the bode function instead:
[mag,phase,wout] = bode(sys)
mag = squeeze(mag);
phase = squeeze(phase);
You will have to transform the radian frequencies in ‘wout’ to Hz:
fHz = wout/(2*pi);
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Plot Customization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!