how to make such type of plot in matlab? we have 4 models and each model have different depth and different velocities v1, v2.
    조회 수: 8 (최근 30일)
  
       이전 댓글 표시
    

댓글 수: 1
  Mathieu NOE
      
 2020년 12월 9일
				hello
when you use the plot function, it can handle multiple groups of x, y data pairs , and they don't need to be of the same length : 
example :  first data x,y  has length 10 , second 20 : 
plot ((1:10),sin((1:10)*pi/10),'b',(1:20),cos((1:20)*pi/10),'r'); grid
채택된 답변
  weikang zhao
      
 2020년 12월 9일
        I tried to restore part of the picture by visually inspecting the values. As a demonstration, two lines (model A & model LE) are provided.
clear
Fig = figure;
hold on;
%% prepare data
model_A = [4,4.5,6,6.8,8,8.5;0,5,17,30,40,45];
model_A = kron(model_A,[1,1]);
model_A = [model_A(1,2:end);model_A(2,1:end-1)];
model_LE = [4,5,5.6,6.2,6.4,6.6,6.7,7.2;0,2,5,15,20,25,32,45];
model_LE = kron(model_LE,[1,1]);
model_LE = [model_LE(1,2:end);model_LE(2,1:end-1),];
line1 = plot(model_A(1,:),model_A(2,:),'k');
line2 = plot(model_LE(1,:),model_LE(2,:),'k','LineWidth',2);
Axes = Fig.CurrentAxes;%Get the Axes object
xlabel('Vp(km/s)');%Set x label
ylabel('depth(km)');%Set y label
legend('A','LE');%Add legend
set(Axes,'XAxisLocation','top');%Set x axis to the top
set(Axes,'YDir','reverse');%Reverse y axis
axis([4,9,0,50]);%Set axis limits and aspect ratios
have fun!
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


