Plotting graph over image
古いコメントを表示
Hello all I have plotted an image on matlab. I have another plot of a single cross that I want to appear over the image at the height inputted by the user. The code can be seen below. Currently the image appears then disappears for the cross to be plotted in the same figure window however I want the image to remain and the cross to appear on the image. I think it could be an issue with 'hold off' but I have tried this and can't crack the problem, any help would be greatly appreciated.
if true
altitude = 'Please enter the altitude in metres you wish to detonate: ';
altitude = input(altitude);
if (altitude<=100);
disp('This is an aerial burst estimator, please enter a number greater than 100 metres.')
elseif (altitude>100000);
disp('The Test Ban Treaty of 1963 prohibits nuclear weapons tests "or any other nuclear explosion"')
disp('in the atmosphere, in outer space, and under water.')
return
end
clf
rgb = imread('altitude4.png');
imshow(rgb)
hold on
M = size(rgb,1);
N = size(rgb,2);
for k = 1:25:M
x = [1 N];
y = [k k];
plot(x,y,'Color','w','LineStyle','-');
plot(x,y,'Color','k','LineStyle',':');
end
for k = 1:25:N
x = [k k];
y = [1 M];
plot(x,y,'Color','w','LineStyle','-');
plot(x,y,'Color','k','LineStyle',':');
end
hold
x = 0.5;
y = altitude;
plot(x,y,'*')
ylim([0 750])
xlim([0 1])
ylabel('Altitude (meters)');
help hold
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Transforms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!