Superposition of two plots: (1) plot matrix (2) horizontal lines.

1 次查看(过去 30 天)
Hello, I want to plot points from a 26x2 matrix and two horizontal lines representing an interval around the maximum value, all three in the same figure. I manage to plot the matrix point by using plot matrix but I can't plot the two horizontal lines (I tested these horizontal plots separately and they worked). I only see two short dashes on the y-axis. This is my code :
%
E_matrix = [0 97594105.7877297;1 91689045.4803060;2 94667284.1402778;...
3 98150602.9496285;4 97601187.4310221;5 97297406.4860670;...
6 96119910.2269929;7 94235325.5743332;8 91103945.5378485;...
9 86252148.8764753;10 83117717.2198853;11 79810687.5818826;...
12 73705295.6152776;13 69472079.8383885;14 63535971.8214140;...
15 57263601.5065311;16 51282327.8999928;17 47099704.4723444;...
18 43603813.7767508;19 40128819.9041277;20 36938571.2842874;...
21 33499378.1981204;22 31561049.5334555;23 29460985.2107030;...
24 25814629.3522583;25 22907368.6361586];
f=1;
while E_matrix(f,2)>E_matrix(f+1,2)
E_matrix(f,:)=[];
f=f+1
end
figure(1);
plotmatrix(E_matrix(:,1), E_matrix(:,2));
Int_prec=0.05;
Emax=max(E_matrix(:,2));
max_E_Int=Emax+Int_prec*Emax;
min_E_Int=Emax-Int_prec*Emax;
x_line=[0 26];
y_line_min=[min_E_Int min_E_Int];
y_line_max=[max_E_Int max_E_Int];
hold on;
line(x_line, y_line_min,'Color','red')
hold on;
line(x_line,y_line_max,'Color','red')
plotmatrix(E_matrix(:,1), E_matrix(:,2))
Could you help me please?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by