댓글 수: 5

John D'Errico
John D'Errico 2023년 5월 23일
Trivial. You already have the image. So read it into MATLAB, using imread.
JIBIN
JIBIN 2023년 5월 23일
i want to create this image using different functions in matlab
Star Strider
Star Strider 2023년 5월 23일
Use the patch and annotation functions.
DGM
DGM 2023년 5월 24일
편집: DGM 2023년 5월 24일
Is that supposed to be one object, or nine adjacent objects with different color/hatch fills?
Are the dimensioning marks required in the output?
What is the intended output? Do you want a ephemeral graph in a figure, or a raster image array that can be saved? Or are you trying to actually create some sort of vector image or STL file?
EDIT:
Also, how exactly is the length of the object defined?
  • Is it defined as certain number of edge cycles N of length period, such that the object is N*period long?
  • Is the object length + period/2 long -- in which case there are 1+(length - period/2)/period edge cycles? Is there any assurance that (length - period/2) is integer-divisible by period?
  • Is there a certain number of edge cycles N-1/2 within length -- in which case period is length/(N - 1/2)?
What are the actual parameters that unambigiously and completely describe the object geometry?
JIBIN
JIBIN 2023년 5월 27일
this is a single image.

댓글을 달려면 로그인하십시오.

 채택된 답변

DGM
DGM 2023년 5월 27일

1 개 추천

Without clarification, I'm going to take the liberty to assume that you want a plain line plot with no dimensioning marks.
% parameters
l = 100;
w = 50;
x = 10;
y = 10;
n = 4;
% build one cycle
xx = [0 x x l/n];
yy = [0 0 y y];
% expand to n cycles on one side
xx = reshape(xx(:) + (0:n-1)*l/n,1,[]);
yy = repmat(yy,1,n);
% flip to create other side
xx = [xx flip(xx)];
yy = [yy w-flip(yy)];
% close the path
xx = xx([1:end 1]);
yy = yy([1:end 1]);
plot(xx,yy)
axis equal

댓글 수: 2

JIBIN
JIBIN 2023년 6월 19일
how can i convert this into a function. and when i call the function i want to get the image

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2023년 5월 23일

댓글:

DGM
2023년 6월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by