Register to reply

I need Matlab help comparing bode plots neatly

by Vagabond7
Tags: bode, comparing, matlab, neatly, plots
Share this thread:
May7-14, 02:07 PM
P: 33
This definitely isn't a homework question as the work is already done, I'm just trying to make my presentation neater for some reports I'm turning in.

I am comparing theoretical data collected from a filter, to the actual data collected. I want to overlay the two to make the comparison. I am trying to do this for both the gain, and the phase difference. I have a plot for the gain, I have a plot for the phase difference, and I have the bodeplot that has both. But I can't seem to overlay everything.

Here is the code I have if any matlab whizzes can help me figure out how to do it. All of the plots themselves are correct, I don't need help with them. I just want to overlay the gain plot and phase plot over the respective parts of the bode plot.

sys=tf([0 -8200], [0 .12874 1570])
bodeplot(sys) %this is the bodeplot for the theoretical values

x=[100 1885 3142 10681 12566 14451 31416 628318 1000000]; %start of the gain plot for data
V=[10.2 10.2 9.8 7.6 7 6.4 3.8 .3 0];
subplot(2,1,1); semilogx(x,y,'r') %this is the end of gain plot for data

P=[189 189 165 140 136 126 116 92 92];
subplot(2,1,2); semilogx(x,P,'r') %This is the phase plot for real data

% subplot plots both the gain and phase plots together

simply adding a "hold on" command in there doesn't over lay the bode plot on the other plots. Any suggestions or commands anybody can think of the get everything lined up?
Phys.Org News Partner Engineering news on
'Smart material' chin strap harvests energy from chewing
Lockheed Martin advances live, virtual, constructive training in flight test
Lockheed Martin conducts flight tests of aircraft laser turret for DARPA
May7-14, 11:19 PM
P: 33
I figured it out. The "hold on" command works in the order that the plots are listed so essentially the form of the code that worked was

gain plot
hold on
bode plot
hold on
phase plot

and then it overlapped everything the way I wanted it. Just in case anybody else wants to know.

Register to reply

Related Discussions
Bode Plots in RL and RC circuits Classical Physics 1
Bode Plots of CR Networks Engineering, Comp Sci, & Technology Homework 1
Phase and Bode Plots Engineering, Comp Sci, & Technology Homework 1
Help with bode plots General Engineering 1
Bode plots Electrical Engineering 1