Plotting inside a loop - reset axes values

2 visualizaciones (últimos 30 días)
Zachary Reinke
Zachary Reinke el 11 de Nov. de 2017
Comentada: Walter Roberson el 12 de Nov. de 2017
Please see pic. I can't get the default values for he secondary axes to go away. They persistently stay on the plot
% Create figure
figure1 = figure;
x0=0;
y0=0;
width=24;
height=14;
set(figure1,'units','inch','position',[x0,y0,width,height]);
tStep = 5*0.05
for i = 1:1:100
L = W;
Y = Data(i,:,1);
X = Data(i,:,2);
St = Data(i,1,3);
index = round(St/0.05);
L(index) = 100;
L(index+5) = 100;
% Create axes
axes1 = axes('Parent',figure1,...
'Position',[0.0578034682080925 0.631751227495908 0.922928709055877 0.320785597381343]);
hold(axes1,'on');
% Create plot
plot(t,v,'Parent',axes1,'LineWidth',1.5);
% Create plot
plot([St,St],[80,-20],'Parent',axes1,'LineWidth',1.5,'Color',[1 0 0]);
% Create plot
plot([St + tStep,St + tStep],[80,-20],'Parent',axes1,'LineWidth',1.5,'Color',[1 0 0]);
hold(axes1,'off');
% Create ylabel
ylabel({'Voltage',''});
% Create xlabel
xlabel('Time');
% Create title
title('Desired Response');
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes1,[7 35]);
box(axes1,'on');
% Create axes
axes2 = axes('Parent',figure1,...
'Position',[0.0606936416184971 0.08 0.917148362235067 0.43],'nextplot','replaceall');
% Create plot
plot(X,Y,'Parent',axes2,'LineWidth',1,...
'Color',[1 0 0]);
% Create ylabel
ylabel({'Error',''});
% Create xlabel
xlabel('Amplitude');
% Create title
title('Error Sensitivity');
box(axes2,'on');
xlim(axes2,[0 4.9]);
pause(1.5);
cla(axes2,'reset');
  3 comentarios
Zachary Reinke
Zachary Reinke el 12 de Nov. de 2017
I want the labels there. If you look closely at the picture there are two sets of numbers. I only want one set.
Walter Roberson
Walter Roberson el 12 de Nov. de 2017
Unfortunately we do not have the values of some of your variables to test with. I do not see anything obvious

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Animation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by