I have this code with an image, and a diagonal line and a point plotted on the image. I want the point to move straight up and down whenever I press the space bar. When I run this code, I get two separate things - one with the image, line and dot, and one with the dot that moves up and down but on a blank background. What do I need to do to combine the two?
fs=100e3;
f=5000;
dur = .0002;
ns = dur*fs;
t=(0:1:ns-1)/fs;
a=1;
phi=0;
x=0;
imshow('AvgBscan.tiff');
[rows, columns, numberOfColorChannels] = size('AvgBscan.tiff');
x = [0,150];
y = [0,100];
line(x,y, 'LineWidth', 4, 'Color', [1, 0, 1]);
plot(50,33,'yo', 'MarkerSize', 12)
for t_i = 1:length(t)
y = a*sin(2*pi*f*t(t_i) + phi);
axis on
hold on;
h=figure;
plot([-1 1],[0 0],'k--');
xlim([-1 1]);
ylim([-1 1]);
pause;
end
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/588769-seeing-the-image-overlaid-on-image#comment_996400
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/588769-seeing-the-image-overlaid-on-image#comment_996400
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/588769-seeing-the-image-overlaid-on-image#comment_996445
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/588769-seeing-the-image-overlaid-on-image#comment_996445
Sign in to comment.