| 5 | 1/1 | 返回列表 |
| 查看: 1969 | 回復(fù): 2 | |||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | |||
簡(jiǎn)單男人24新蟲 (初入文壇)
|
[求助]
k-means聚類分析實(shí)現(xiàn)程序
|
||
|
[X,textdata]=xlsread('信號(hào)特征參數(shù).xls'); %讀取信號(hào)特征向量矩陣 x=zscore(X); %數(shù)據(jù)標(biāo)準(zhǔn)化 [idx,C,sumd,D]=kmeans(x,4, 'Replicates',5); Cluster1=X(idx==1, ; %第一類信號(hào)Cluster2=X(idx==2, ; %第二類信號(hào)Cluster3=X(idx==3, ; %第三類信號(hào)Cluster4=X(idx==4, ; %第四類信號(hào)figure(3); %分類后持續(xù)時(shí)間與幅值 plot(Cluster1(:,3),Cluster1(:,1), 'rs', 'Matkersize',12); hold on plot(Cluster2(:,3),Cluster2(:,1), 'b^', 'Matkersize',12); plot(Cluster3(:,3),Cluster3(:,1), 'cp', 'Matkersize',12); plot(Cluster4(:,3),Cluster4(:,1), 'bo', 'Matkersize',12); axis([0 4000 0 100]); xlabel(''Duration, μs''); ylabel(' Amplitude, dB '); 請(qǐng)問這個(gè)k-means聚類分析實(shí)現(xiàn)程序每一步的含義是什么 原始數(shù)據(jù)應(yīng)該是什么樣子的 請(qǐng)各位大神幫忙看下 |
source |
新蟲 (初入文壇)
捐助貴賓 (初入文壇)
|
讀入數(shù)據(jù)表 [X,textdata]=xlsread('信號(hào)特征參數(shù).xls'); %讀取信號(hào)特征向量矩陣 標(biāo)準(zhǔn)化就是使得數(shù)據(jù)沒列均值為0, 標(biāo)準(zhǔn)差為1. x=zscore(X); %數(shù)據(jù)標(biāo)準(zhǔn)化 聚類,聚成4類,試5組初始值,選最好的聚類結(jié)果 [idx,C,sumd,D]=kmeans(x,4, 'Replicates',5); ids中保存了每個(gè)數(shù)據(jù)點(diǎn)所在的類 Cluster1=X(idx==1,; %第一類信號(hào) Cluster2=X(idx==2,; %第二類信號(hào) Cluster3=X(idx==3,; %第三類信號(hào) Cluster4=X(idx==4,; %第四類信號(hào) figure(3); %分類后持續(xù)時(shí)間與幅值 下面幾行分別畫出各個(gè)類別的散點(diǎn)圖,用不同的點(diǎn)表示類別。取第三列值為X,第1列值為Y plot(Cluster1(:,3),Cluster1(:,1), 'rs', 'Matkersize',12); hold on % 把下面的點(diǎn)畫到同一個(gè)圖上,而不是新起一個(gè)圖。 plot(Cluster2(:,3),Cluster2(:,1), 'b^', 'Matkersize',12); plot(Cluster3(:,3),Cluster3(:,1), 'cp', 'Matkersize',12); plot(Cluster4(:,3),Cluster4(:,1), 'bo', 'Matkersize',12); 顯示坐標(biāo)軸,X范圍為0-4000, Y為0-100 axis([0 4000 0 100]); X軸名字 xlabel(''Duration, μs''); Y軸名字 ylabel(' Amplitude, dB '); |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 266分,一志愿電氣工程,本科材料,求材料專業(yè)調(diào)劑 +4 | 哇呼哼呼哼 2026-04-02 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 265求調(diào)劑 +9 | 林深溫瀾 2026-04-01 | 11/550 |
|
|
[考研] 一志愿北京理工大學(xué)本科211材料工程294求調(diào)劑 +8 | mikasa的圍巾 2026-03-28 | 9/450 |
|
|
[考研] 292分,材料與化工,申請(qǐng)調(diào)劑 +19 | 程晴之 2026-04-01 | 23/1150 |
|
|
[考研] 329求調(diào)劑 +8 | miaodesi 2026-04-02 | 10/500 |
|
|
[考研] 316求調(diào)劑 +11 | 舟自梗 2026-04-01 | 12/600 |
|
|
[考研] 各位老師好,我的一志愿為北京科技大學(xué)085601材料專碩 +13 | Koxui 2026-03-28 | 13/650 |
|
|
[考研] 08工科275分求調(diào)劑 +13 | AaAa7420 2026-03-31 | 13/650 |
|
|
[考研] 085602化學(xué)工程268分蹲調(diào)劑 +8 | 月照花林。 2026-04-01 | 8/400 |
|
|
[考研] 339求調(diào)劑,想調(diào)回江蘇 +7 | 烤麥芽 2026-03-27 | 10/500 |
|
|
[考研] 材料調(diào)劑 +14 | 一樣YWY 2026-04-01 | 14/700 |
|
|
[考研] 310分求調(diào)劑 +4 | 成功上岸wang 2026-04-01 | 4/200 |
|
|
[考研] 材料科學(xué)與工程339求調(diào)劑 +11 | hyz0119 2026-03-31 | 12/600 |
|
|
[考研] 285求調(diào)劑 +7 | AZMK 2026-03-30 | 13/650 |
|
|
[考研] 環(huán)境工程 085701,267求調(diào)劑 +15 | minht 2026-03-29 | 16/800 |
|
|
[基金申請(qǐng)] 面上5B能上會(huì)嗎? +8 | redcom 2026-03-29 | 8/400 |
|
|
[考研] 286求調(diào)劑 +6 | Faune 2026-03-30 | 6/300 |
|
|
[考研] 334分 一志愿武理 材料求調(diào)劑 +16 | 李李不服輸 2026-03-26 | 16/800 |
|
|
[考研] 085602 化學(xué)工程專碩 340分求調(diào)劑 +4 | qianbai11 2026-03-29 | 4/200 |
|
|
[考研] 295求調(diào)劑 +5 | 1428151015 2026-03-27 | 6/300 |
|