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
Best Answer