How to import data to draw bode
Show older comments
I tested the data as follows
*Frequency....Out-abs..... Out-phase
10...... 0.0911222683470981..... -1.58847081420007
17.1132830416178 ......0.155513705289354 ......-1.59826007442724
29.2864456462524 ......0.265372788697364 ......-1.61337362876168
50.1187233627272 ......0.452875507309409...... -1.63924925736688
85.7695898590894...... 0.771380837522393...... -1.6844579215245
146.779926762207...... 1.30422486175599 ......-1.76177744417405
251.188643150958...... 2.15885228954428...... -1.88922949657677
429.866234708228 ......3.38909945622017 ......-2.08389456518048
735.642254459642...... 4.79331476991719 ......-2.33778424860481
1258.92541179417 ......5.90723048305756 ......-2.59657088827632
2154.43469003188 ......6.51210885390879 ......-2.80121801151038
3686.94506451958 ......6.76551329794937 ......-2.93773717631133
6309.57344480193 ......6.85906013908311 ......-3.02175637289138
10797.7516232771 ......6.89190068991012 ......-3.07200435455205
18478.4979742229 ......6.9032185997441 ...... -3.10201666772075
31622.7766016838 ......6.90708374137897 ......-3.12039586346281
54116.9526546464 ......6.90836924161824 ......-3.13252146311361
92611.8728128794...... 6.90870360455884 ......-3.14196763982071
158489.319246112...... 6.90851104747202...... -3.15152485034634
271227.257933203...... 6.90754724630841 ......-3.16401689981387
464158.883361278 ......6.90459064111762 ......-3.18312952818843
794328.234724283 ......6.8959080205459 ......-3.21447528466877
1359356.39087853...... 6.87065827244468 ......-3.26713087846712
2326305.06715363 ......6.79832956499895 ......-3.35572740118132
3981071.70553497...... 6.59941778875662 ......-3.50204977064032
6812920.69057961 ......6.10718328006143...... -3.73075734041662
11659144.0117983 ......5.13927320828323 ......-4.04839453004176
19952623.1496888 ......3.82351328567971...... -4.42101649285181
34145488.738336 ...... 2.62807468084941 ......-4.80832034047117
58434141.3373518...... 1.83567026586748 ......-5.20125372342626
99999999.9999999 ......1.41059927338957 ......-5.58031981846252
The first column is the coordinates of ‘X’
The second column is the amplitude of the ‘Y’ coordinates of the bode
The third column is the phase of the ’ Y’ coordinates of the bode
How do I import these data and draw bode diagram with MATLAB and How to export MATLAB bode diagram data’s with this data format?
2 Comments
Azzi Abdelmalek
on 10 Sep 2012
import from what? text file? excel file?
Sunetra Sawant
on 20 Feb 2023
How to plot frequencies on x-axis, just like bode plots format?
Answers (1)
Azzi Abdelmalek
on 10 Sep 2012
Edited: Azzi Abdelmalek
on 10 Sep 2012
data=[10 0.0911222683470981 -1.58847081420007
17.1132830416178 0.155513705289354 -1.59826007442724
29.2864456462524 0.265372788697364 -1.61337362876168
50.1187233627272 0.452875507309409 -1.63924925736688
85.7695898590894 0.771380837522393 -1.6844579215245
146.779926762207 1.30422486175599 -1.76177744417405
251.188643150958 2.15885228954428 -1.88922949657677
429.866234708228 3.38909945622017 -2.08389456518048
735.642254459642 4.79331476991719 -2.33778424860481
1258.92541179417 5.90723048305756 -2.59657088827632
2154.43469003188 6.51210885390879 -2.80121801151038
3686.94506451958 6.76551329794937 -2.93773717631133
6309.57344480193 6.85906013908311 -3.02175637289138
10797.7516232771 6.89190068991012 -3.07200435455205
18478.4979742229 6.9032185997441 -3.10201666772075
31622.7766016838 6.90708374137897 -3.12039586346281
54116.9526546464 6.90836924161824 -3.13252146311361
92611.8728128794 6.90870360455884 -3.14196763982071
158489.319246112 6.90851104747202 -3.15152485034634
271227.257933203 6.90754724630841 -3.16401689981387
464158.883361278 6.90459064111762 -3.18312952818843
794328.234724283 6.8959080205459 -3.21447528466877
1359356.39087853 6.87065827244468 -3.26713087846712
2326305.06715363 6.79832956499895 -3.35572740118132
3981071.70553497 6.59941778875662 -3.50204977064032
6812920.69057961 6.10718328006143 -3.73075734041662
11659144.0117983 5.13927320828323 -4.04839453004176
19952623.1496888 3.82351328567971 -4.42101649285181
34145488.738336 2.62807468084941 -4.80832034047117
58434141.3373518 1.83567026586748 -5.20125372342626
99999999.9999999 1.41059927338957 -5.58031981846252]
% if your data are in excel file
data=xlsread('YourFileName.xls')
% to plot Bod diagram
f=log10(data(:,1));
gain=20*log(data(:,2));phase=data(:,3);
close;subplot(2,1,1);plot(f,gain);
xlabel('frequency log10(\omega)');ylabel('Gain(dB)');title('Amplitude')
subplot(2,1,2);plot(f,phase);
xlabel('frequency log10(\omega)');ylabel('Phase(rd)');title('Phase')
%to save your data
save filename data % to mat filename
xlswrite('filename.xls',data) % to excel file
dlmwrite('filename.txt',data,' ') % to text file
3 Comments
Janani Baskaran
on 2 Nov 2016
Hi! I have Frequency, Input Voltage and Output voltage on an excel sheet. can i import this into matlab and draw a Bode Plot?
Sunetra Sawant
on 20 Feb 2023
How to plot frequencies on x-axis, just like bode plots format?
bhawya b
on 4 Sep 2023
@Azzi Abdelmalek thanks for the remarkable code but may I know whats data? Does it contain both frequency and phase?
Categories
Find more on Get Started with Control System Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!