How to Use an Image for background in XY Graph in Simulink, 2022a

조회 수: 2 (최근 30일)
Ivan Franco
Ivan Franco 2022년 12월 8일
답변: fangfines 2022년 12월 8일
I have made a simulink model that plots circle in the XY graph using the XY Graph block. I want the plotting to be done over an Image so as to verify the regions it passes through. The image is a jpg, but I can make it png if necessary.
I tried googling but couldnt really find a solution.

답변 (1개)

fangfines
fangfines 2022년 12월 8일
hi, not sure if this is suitable for you, it's a bit rough and low efficiency(low fps), but looks simple, by using MATLAB Function and base line/plot/image build-in method, where the code within "MATLAB Function" is :
function fcn(u)
coder.extrinsic('image')
persistent h;
if isempty(h)
C = imread('ngc6543a.jpg');
image(C,'CDataMapping','scaled');
h = line(0,0);
set(h,"Marker","o");
end
set(h,"XData", u);
set(h,"YData", u);
end

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by