How to apply imagesc on the plot with two lines?

1 view (last 30 days)
I need to paint my plot 1 like this 2, but do not how can I do that. When the curve touches a red line that part of curve becomes red [total amplitude becomes bigger in the area of the envelope] 3. Colors (and colorbar) should show a changing of the amplitude. As I understand, color is changing because there is an an accumulation of the impulse in the parabola (for instance, Ricker's impulse).
phi=pi/5;
b=4000;
if (phi>pi/4)|(phi<-pi/4)
warndlg('Invalid value');
else
a=tan(phi);
x=-4000:100:4000;
y=zeros(1,length(x));
z=a*x+b;
colormap(jet)
line1=plot(x,z,'y','LineWidth',3);xlim([-4000 4000]);ylim([0 7000]);
set(gca,'YDir','reverse');
xlabel('X,m');
shading interp
colormap(jet)
colorbar;
% zoom on
% %title({'Решение задачи сейсмического сноса' , 'для плоской наклонной границы методом огибающей'});
daspect([1 1 1])
zeta=z./cos(phi);
hold on
dz=z*tan(phi)+x;
line2=plot(dz,zeta,'r','LineWidth',3);
pause
for i=1:2:length(x)
xk=x(i)-4000:12.5:x(i)+4000;
d(i)=z(i)*tan(phi)+x(i);
hyp=sqrt((xk-x(i)).^2+z(i).^2);
plot(x(i),z(i),'.r','MarkerSize',25);
pause
plot(xk,hyp,'c');
end
end
clear all
close all

Answers (1)

Image Analyst
Image Analyst on 5 Apr 2020
Not sure what you're asking. imagesc() applied to images, not plots. If you want to grab a snapshot of your axes with getframe() then you can call imshow() or imagesc() followed by rgb2gray() and colormap() if you want.
displayedImage = getframe(); % This is an RGB screenshot of the current axes.

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!