how to draw Sudan Country flag

clc;
clear all;
close all;
a=uint8([zeros(30,50)])
a(11:20,:,1) = 255;
a(11:20,:,2)=255;
a(11:20,:,3) = 255;
a(12:18,1:13,1) = 0;
a(12:18,1:13,2)=254;
a(12:18,1:13,3) = 0;
a(1:10,:,1) = 190;
a(1:10,:,2)=0;
a(1:10,:,3) = 39;
a(3:20,1:3,1) = 0;
a(3:20,1:3,2)=254;
a(3:20,1:3,3) = 0;
a(21:30,:,1) = 0;
a(21:30,:,2)=0;
a(21:30,:,3) = 0;
a(21:26,1:4,1) = 0;
a(21:26,1:4,2)=254;
a(21:26,1:4,3) = 0;
a(8:11,1:8,1) = 0;
a(8:11,1:8,2)=254;
a(8:11,1:8,3) = 0;
a(3:7,1:2,1) = 0;
a(3:7,1:2,2)=254;
a(3:7,1:2,3) = 0;
a(4:8,1:4,1) = 0;
a(4:8,1:4,2)=254;
a(4:8,1:4,3) = 0;
a(18:20,1:8,1) = 0;
a(18:20,1:8,2)=254;
a(18:20,1:8,3) = 0;
a(21:22,1:8,1) = 0;
a(21:22,1:8,2)=254;
a(21:22,1:8,3) = 0;
x=[0.20 0.41]
y=[0.92 0.54]
annotation('line',x,y,'color',[0 1 0],'linewidth',5)
%fill(x,y,'color',[0 1 0])
%annotation('ellipse',[0.44 0.41 0.13 0.22] )
x1=[0.20 .41]
y1=[0.11 0.54]
annotation('line',x1,y1,'color',[0 1 0],'linewidth',5)
%fill(x,y,x1,y1,'color',[0 1 0])
imshow(a)

1 Comment

i got more time consuming,is there any direct mathod to draw triangle?

Sign in to comment.

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 24 Feb 2013
Edited: Azzi Abdelmalek on 24 Feb 2013
close
hold on
larg=6
long=10
x=[0 0 long long 0 0 long long long 0];
y=[larg 0 0 larg/3 larg/3 2*larg/3 2*larg/3 larg/3 larg larg]
fill(x,y,'r','edgecolor','none')
fill([0 long long 0],[0 0 larg/3 larg/3],'k','edgecolor','none')
x1=[0 long/3 0 0],
y1=[0 larg/2 larg 0]
fill(x1,y1,'g','edgecolor','none')
plot([0 long long 0 0],[0 0 larg larg 0],'k')
set(gca,'xtick',[],'ytick',[])
saveas(gcf,'sudan.tif')

1 Comment

atit patel
atit patel on 25 Feb 2013
Edited: atit patel on 25 Feb 2013
thanks,sir.
but i dont got how it works till get some errors like;
??? Error using ==> print at 364 Cannot create output file '.\sudan.tif'
Error in ==> saveas at 156 print( h, name, ['-d' dev{i}] )
Error in ==> Untitled23 at 14 saveas(gcf,'sudan.tif')
can you please explain me if possible?

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!