Export Bode Plot Data to Excel or text file

18 visualizzazioni (ultimi 30 giorni)
VIJETH DSOUZA
VIJETH DSOUZA il 24 Mar 2014
Modificato: Patrik Ek il 24 Mar 2014
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?

Risposte (2)

Patrik Ek
Patrik Ek il 24 Mar 2014
Modificato: Patrik Ek il 24 Mar 2014
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 il 24 Mar 2014
Modificato: Azzi Abdelmalek il 24 Mar 2014
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)

Categorie

Scopri di più su Data Export to MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by