I want to specify some lines so that I can assign a number to them and change the numbers.#And I want to know that when we write for example h=line(x,y) matlab will refer a number to it.Is this number unique? by which logic is it refers them?
MATLAB: Specify lines
line
Related Solutions
Perhaps polyfit() and polyval()?
doc polyfitdoc polyval
Hi,
try:
clfclcclear all close all % DATA
Depth= [0 2 4 6 8 12 16 20 24 28 30 32 36 40];% P-waves
vp_upt= [3.27 5.75 5.85 5.9 5.91 6.15 6.5 6.84 6.84 6.84 6.84 7.34 7.89 7.89];vp_pve_5= [3.4335 6.0375 6.1425 6.195 6.2055 6.4575 6.825 7.182 7.182 7.182 7.182 7.707 8.2845 8.2845];vp_pve_25=[3.35175 5.89375 5.99625 6.0475 6.05775 6.30375 6.6625 7.011 7.011 7.011 7.011 7.5235 8.08725 8.08725];vp_nve_5=[3.1065 5.4625 5.5575 5.605 5.6145 5.8425 6.175 6.498 6.498 6.498 6.498 6.973 7.4955 7.4955];vp_nve_25=[3.18825 5.60625 5.70375 5.7525 5.76225 5.99625 6.3375 6.669 6.669 6.669 6.669 7.1565 7.69275 7.69275];% S-waves
vs_upt= [1.91 3.36 3.42 3.44 3.45 3.59 3.79 3.99 3.99 3.99 3.99 4.28 4.61 4.61];vs_pve_5= [2.0055 3.528 3.591 3.612 3.6225 3.7695 3.9795 4.1895 4.1895 4.1895 4.1895 4.494 4.8405 4.8405];vs_pve_25=[1.95775 3.444 3.5055 3.526 3.53625 3.67975 3.88475 4.08975 4.08975 4.08975 4.08975 4.387 4.72525 4.72525];vs_nve_25=[1.86225 3.276 3.3345 3.354 3.36375 3.50025 3.69525 3.89025 3.89025 3.89025 3.89025 4.173 4.49475 4.49475];vs_nve_5=[1.8145 3.192 3.249 3.268 3.2775 3.4105 3.6005 3.7905 3.7905 3.7905 3.7905 4.066 4.3795 4.3795];% plot data
% colours
c_blue=[0 102 204]/255;c_light_b=[0 255 255]/255;c_green=[88 171 45]/255;c_yellow=[255 220 15]/255;c_red=[207 46 49]/255;plot(vs_pve_5, -Depth,'Color', c_blue,'Linewidth',2)hold onplot(vs_pve_25,-Depth,'Color',c_light_b,'Linewidth',2);plot(vs_upt, -Depth,'Color',c_green,'Linewidth',2);plot(vs_nve_25,-Depth,'Color',c_yellow,'Linewidth',2);plot(vs_nve_5,-Depth,'Color',c_red,'Linewidth',2);% % add p -wave models
plot(vp_pve_5,-Depth,'Color',c_blue,'Linewidth',2);plot(vp_pve_25,-Depth,'Color',c_light_b,'Linewidth',2);plot(vp_upt,-Depth,'Color',c_green,'Linewidth',2);plot(vp_nve_25,-Depth,'Color',c_yellow,'Linewidth',2);plot(vp_nve_5,-Depth,'Color',c_red,'Linewidth',2);% axis
%set(gca, 'FontName','Helvetica','FontSize', 14);
title(' 1-D Velocity Models') xlabel('Velocity (km/s)')ylabel('Depth (km)')legend ('S-wave velocity model increased by 5%', 'S-wave velocity model increased by 2.5%','Unperturbed S-wave velocity model','S-wave model decreased by 2.5%','S-wave velocity model decreased by 5%', 'P-wave velocity model increased by 5%', 'P-wave velocity model increased by 2.5%', 'Unperturbed P-wave velocity model', 'P-wave velocity model decreased by 2.5%', 'P-wave velocity model decreased by 5%')legend('Location','eastoutside')
result is:
Best regards
Stephan
Best Answer