Export Bode Plot Data to Excel or text file

16 次查看(过去 30 天)
Is it possible to export Bode Plot data to excel or text file?
Or is there any other way to obtain complete data of bode plot?

回答(2 个)

Patrik Ek
Patrik Ek 2014-3-24
编辑:Patrik Ek 2014-3-24
Given the data you can export a matrix or a cell array of data using xlswrite. If you have a matrix you can just use
xlswrite(filename,data) % data is a MxN matrix and gives MxN excel cells.
Otherwise if you want to export strings or want some kind of structure of the excel file you can have a cell with data,
xlswrite(filename,data) % data is a cell and each matlab cell gives an excel cell.
which allows you to do something like
freq amp
0.1 0
1 0
10 -3
... ...
If you have a matrix which you want to transform to a cell use mat2cell.
However I am not sure what you mean with "obtain the complete data of the bodeplot". Since you did say you wanted to export it, I would say this requires that you already have the complete data or otherwise specify the missing data, which should be possible to obtain in matlab. Also if you, with obtain, meant that you wanted to "store" the data, I would recommend that you uses matlabs save if you want to save it for new use in matlab, xlswrite if you want to use it in excel and fprintf to write it to a .txt file.

Azzi Abdelmalek
Azzi Abdelmalek 2014-3-24
编辑:Azzi Abdelmalek 2014-3-24
I don't know how you get a bode plot, if like below:
% N=1;
% D=[1 10];
[a,p,w]=bode(N,D)
subplot(2,1,1)
plot(log10(w),20*log10(a)) % Amplitude
subplot(2,1,2)
plot(log10(w),p) % Phase
%---save data to Excell file------------
M=[log10(w) 20*log10(a) p] % frequencies amplitudes and phases
xlswrite('YourFileName.xlsx',M)

类别

Help CenterFile Exchange 中查找有关 Data Export to MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by