MATLAB繪圖

matlab繪製散點圖

clc,clearjquery

x=[11.9,11.5,14.5,15.2,15.9,16.3,14.6,12.9,15.8,14.1];數組

y=[196.84,196.84,197.14,197.03,197.05,197.13,197.04,196.96,196.95,196.98];函數

plot(x,y,'.')ui

Matlab將座標系中的點鏈接起來spa

 

matlab繪製點線圖

U
V
R=V./(U+V)
%圖形展現出來
x=[1 2 3 4 5 6 7];
plot(x,U,'-.R*','LineWidth',2);
hold on;
plot(x,V,'-.G+','LineWidth',2);
hold on;
plot(x,R,'-.Mo','LineWidth',2);
%hold on;
%grid on;
xlabel('Number');
ylabel('Recognition rate (%)');blog

 

matlab:對單個矩陣plot繪圖的說明utf-8

實例:a=magic(5)

a =

    17    24     1     8    15
    23     5     7    14    16
     4     6    13    20    22
    10    12    19    21     3
    11    18    25     2     9

plot(a)
grid on
get


x=rand(10,1,40); % 隨機取40個數 一個當橫座標 一個當縱座標
y=rand(10,1,40);
%畫圖
plot(x( 1:10),y( 1:10),'r.');hold on; % 點 r=紅色
plot(x(11:20),y(11:20),'g*');hold on; % 星星 g=綠色
plot(x(21:30),y(21:30),'o');hold on; % 圓圈 默認是藍色
plot(x(31:40),y(31:40),'mo','MarkerSize',15) % 大大的圓圈 m=紫色

 

分別按行組和行列繪製三維條形圖input

Y = round(rand(5,3)*10);            %隨機函數產生5*3的數組,對產生的數據取整it

subplot(2,2,1)

bar(Y,'group')

title 'Group'

subplot(2,2,2)

bar(Y,'stack')                     %堆型二維垂直條形圖

title 'Stack'

subplot(2,2,3)

barh(Y,'stack')                    %堆型二維水平條形圖

title 'Stack'

subplot(2,2,4)

bar(Y,1.5)                       %設定條形的寬度爲1.5

title 'Width = 1.5'

效果如圖

 

 

Y = [1 2 3 4 5 6 7;

       1 2 3 4 3 2 1;

    76 5 4 3 2 1];

subplot(3,2,1)

bar3(Y,'detached')

title('Detached')

subplot(3,2,2)

bar3(Y,0.25,'detached')

title('Width = 0.25')

subplot(3,2,3)

bar3(Y,'grouped')

title('Grouped')

subplot(3,2,4)

bar3(Y,0.5,'grouped')

title('Width = 0.5')

subplot(3,2,5)

bar3(Y,'stacked')

title('Stacked')

subplot(3,2,6)

bar3h(Y,0.3,'stacked')

title('Width = 0.3')

效果如圖

 

Matlab將座標系中的點鏈接起來

  1. clc; clear all; close all;
  2. y=[60,58,55,53,53,53,51,50,49,46,41,41,41,40,39,40,40,40]; 
  3. x=[229,230,231,232,232,233,234,235,235,237,239,239,239,240,241,241,240,240];
  4. figure; hold on; box on;
  5. [x1, ind] = sort(x);
  6. y1 = y(ind);
  7. [b1, m1, n1] = unique(x1, 'first');
  8. xt = linspace(min(x), max(x));
  9. yt = interp1(x1(m1), y1(m1), xt, 'spline');
  10. plot(xt, yt, 'r-');
  11. plot(x, y, 'k*')
相關文章
相關標籤/搜索