『壹』 求!!!怎麼用MATLAB給指定區域填充顏色在y1=1-x與y2=x+1和x軸圍成的三角形區域中填充顏色
可這樣:
x=-1:0.01:1;
y1=1-x;y2=x+1;y3=zeros(size(x));
plot(x, y1, x, y2,x,y3),hold on
x1=-1:0.01:0;x2=0.01:0.01:1;
z1=x1+1;z2=1-x2;
z=[z1 z2];
area(x,z,'FaceColor','b')
hold off
『貳』 數字圖像處理matlab,封閉區域填充顏色!
1、二值指的是只有0-1兩個值,對於灰度圖而言是不存在顏色的概念的,三個通道的彩色圖像才有顏色
2、可轉換成彩色圖像,也就是背景是黑色,白色塊填充填充紅,綠,藍任意一個顏色,比如填充紅色
clc; clear all; close all;
I%就是你的二值圖像,二值圖像
I = logical(I);
J = zeros(256, 256, 3);
J1 = J(:, :, 1); J1(I) = 255; J1(~I) = 0;
J2 = J(:, :, 1); J2(I) = 0; J2(~I) = 255;
J3 = J(:, :, 1); J3(I) = 0; J3(~I) = 0;
J = cat(3, J1, J2, J3);
figure;
subplot(1, 2, 1); imshow(I, []); title('原二值圖像', 'FontWeight', 'Bold');
subplot(1, 2, 2); imshow(J, []); title('二值圖像加色顯示', 'FontWeight', 'Bold');
『叄』 怎樣在matlab中畫矩形並填充顏色
1、首先,在打開的matlab軟體上新建一個腳本來保存編寫的代碼,如圖所示:
『肆』 matlab作圖區域填色,急!
t = (1/16:1/8:1)'*2*pi;
x = sin(t);
y = cos(t);
fill(x,y,'r')
axis square
Y = [1, 5, 3;
3, 2, 7;
1, 5, 3;
2, 6, 1];
figure
h = area(Y);
set(h(1),'FaceColor',[0,0.25,0.25]);
set(h(2),'FaceColor',[0,0.5,0.5]);
set(h(3),'FaceColor',[0,0.75,0.75]);
『伍』 matlab 如何自定義顏色
matlab畫平面分布圖時colorbar的設置是非常重要的,好的colorbar不僅使圖像更美觀,而且能夠使人更容易捕捉圖上傳遞的信息。用過matlab的同學都知道matlab默認的colormap是jet, 也就是你畫完圖後輸入「colorbar」 它所顯示出來的顏色。此外,matlab還自帶了很多colormap, 如hsv, autumn, bone, colorcube等等。我們直接在命令窗口輸入例如"colormap(hsv)" 就可以是平面圖的顏色顯示相應的colormap。
下面教大家如何自定義自己想要的colormap,方法十分簡單。
以中國海的海面溫度圖為例:
『陸』 matlab中如何對一條曲線和X軸之間的區域進行顏色的填充,比如一個高斯曲線下對應不同X段范圍填充不同的顏
t=0:0.01:2*pi;
y=sin(t);
y2=y+2;
plot(t,y,t,y2,'r');
hold on% 如果t的維數較小,可以加細。
n=length(t);
for i=1:nx1=[t(i),t(i)];
y1=[y(i),y2(i)];
plot(x1,y1,'k');
end
『柒』 在matlab中畫出圓,如何給其填充顏色
1、首先在電腦中打開matlab -->點擊「新建腳本文件」(或同時按下ctrl +N),就可以建立一個腳本文件,在腳本文件中編寫程序方便修改。
『捌』 matlab中如何給特定區域填充色彩
使用fill函數,具體的方法是
fill(x,y,c)
其中區域是使用x和y來指定,c來指定顏色
例如fill([0 1 1 0],[0 0 1 1],'r')是給一個矩形區域填充紅色
FILL(X,Y,C) fills the 2-D polygon defined by vectors X and Y
with the color specified by C. The vertices of the polygon
are specified by pairs of components of X and Y. If necessary,
the polygon is closed by connecting the last vertex to the first.
If C is a single character string chosen from the list 'r','g','b',
'c','m','y','w','k', or an RGB row vector triple, [r g b], the
polygon is filled with the constant specified color.
祝你學習愉快!