walex.io
Log in

IDP-伺服壓床-Bruce

created: 2025-10-07 13:27:26modified: 2025-10-17 02:42:04
public
bruce


Open in Platograph


這份文獻匯集了關於智能設計範式的多個主題,涵蓋了機械工程、自動化控制、伺服壓床及人工智慧等領域。其中探討了石頭和金屬混合物的故事、自動機械工程的齒輪結構、以及奈米複合材料的分子結構。這些範疇著重於熱變形、摩擦、耐久性和靜音等方面,展示了奈米技術的應用。同時介紹了具有轉換作用的致動器系統,包括氣動、液壓、電動和機械致動器,用於AIoT機器人技術中的能源轉換。此外,還討論了利用伺服馬達精確控制工業壓床的優勢,並比較其與傳統液壓或機械壓床在精度、能源效率和靈活性方面的差異。在人工智慧方面,提及了解決複雜問題的架構、解決問題和創新的20個步驟,以及國立台北科技大學的圖靈歐拉項目。整體而言,這些文件呈現了一個廣泛而多元的技術領域,展示了科技與創新在當今社會中的重要性與應用價值。




Matlab 數據繪圖


目前問題:

抓不到50組數據,無法繪出50組數據

% ====== 讀取:以「時間、壓力、位址」欄名自動配對 ======
filename = 'C:UsersbruceOneDrive桌面22雙層齒伺服壓床數據.csv';
expectedGroups = 1; % 期望組數(可改)
% 讀檔並保留原始欄名(含中文)
T = readtable(filename, 'Delimiter', ',', 'TextType', 'string', ...
'Encoding','UTF-8', 'VariableNamingRule','preserve');
vars = string(T.Properties.VariableNames);
% 找出各類欄位(支援中英關鍵字、可帶數字索引)
[timeIdx, timeID] = findCols(vars, ["時間","Time"]);
[pressIdx,pressID]= findCols(vars, ["壓力","壓强","Pressure"]);
[posIdx, posID] = findCols(vars, ["位址","地址","位置","位移","Position","Pos"]);
% 依數字後綴配對;若沒有數字後綴則以出現順序配對
groups = buildGroups(timeIdx,timeID, pressIdx,pressID, posIdx,posID);
nGroups = numel(groups);
fprintf("找到 %d 組欄位%sn", nGroups, ...
ternary(nGroups==expectedGroups, "(與期望相符)", "(與期望不符,請檢查欄名或數量)"));
% 將每組欄位轉為數值並存成結構陣列
dataGroups = repmat(struct('time',[],'pressure',[],'position',[], ...
'timeCol',[],'pressCol',[],'posCol',[]), nGroups, 1);
for k = 1:nGroups
dataGroups(k).time = toNumCol(T{:, groups(k).timeCol});
dataGroups(k).pressure = toNumCol(T{:, groups(k).pressCol});
dataGroups(k).position = toNumCol(T{:, groups(k).posCol});
dataGroups(k).timeCol = vars(groups(k).timeCol);
dataGroups(k).pressCol = vars(groups(k).pressCol);
dataGroups(k).posCol = vars(groups(k).posCol);
end
% 範例:畫第 1 組(可把 g 改成 1~nGroups)
g = 1;
t = dataGroups(g).time(:); % 強制欄向量
P = dataGroups(g).pressure(:);
pos = dataGroups(g).position(:);
% 逐列有效性過濾(避免隱式擴張)
n = min([numel(t), numel(P), numel(pos)]);
t = t(1:n); P = P(1:n); pos = pos(1:n);
rowMask = isfinite(t) & isfinite(P) & isfinite(pos);
t = t(rowMask); P = P(rowMask); pos = pos(rowMask);
% 嘗試依「數量/批次/序號」分段
cleanNames = normalizeName(vars);
countCol = find(contains(cleanNames, ["數量","数量","count","序號","序号","批次","批號","批号","group","index"]), 1);
useBatchPlot = false;
if ~isempty(countCol)
cntAll = toNumCol(T{:, countCol});
cnt = cntAll(rowMask); % 與 t/P/pos 對齊
ug = unique(cnt(isfinite(cnt)), 'stable');
useBatchPlot = numel(ug) >= 2; % 有兩段以上才分段
end
% 作圖
fig = figure('Color',[0.75 0.75 0.75]); ax = axes(fig); hold(ax,'on');
if useBatchPlot
% 依批次分段畫線,不會互相連起來
ug = unique(cnt(isfinite(cnt)), 'stable');
yyaxis(ax,'left');
for i = 1:numel(ug)
idx = cnt == ug(i);
plot(t(idx), P(idx), 'b', 'LineWidth', 1);
end
ylabel('Pressure'); ylim([0 800]); yticks(0:200:800);
yyaxis(ax,'right');
for i = 1:numel(ug)
idx = cnt == ug(i);
plot(t(idx), pos(idx), 'Color',[0 0.5 0], 'LineWidth', 1);
end
ylabel('Position'); ylim([120 200]); yticks(120:20:200);
else
% 找不到批次欄:在時間回跳處插入 NaN 斷線,避免放射狀直線
brk = [false; diff(t) <= 0]; % 時間回跳或重置
t2 = t; P2 = P; pos2 = pos;
t2(brk) = NaN; P2(brk) = NaN; pos2(brk) = NaN;
yyaxis(ax,'left'); plot(t2, P2, 'b', 'LineWidth', 1);
ylabel('Pressure'); ylim([0 800]); yticks(0:200:800);
yyaxis(ax,'right'); plot(t2, pos2, 'Color',[0 0.5 0], 'LineWidth', 1);
ylabel('Position'); ylim([120 200]); yticks(120:20:200);
end
% 共用 X 軸:Time
xlabel('Time(ms)');
xlim([0 4500]); xticks(0:500:4500);
% 軸標籤顏色與線條一致
ax.YAxis(1).Color = [0 0 1]; % 左(Pressure)藍
ax.YAxis(2).Color = [0 0.5 0]; % 右(Position)綠
title(sprintf('組別 %d / %d', g, nGroups));
grid(ax,'on');
% ====== 輔助函式 ======
function [idx, ids] = findCols(vars, bases)
% 用 contains 提高容錯(避免因前面有隱藏字元而漏抓)
idx = []; ids = [];
for i = 1:numel(vars)
name = normalizeName(vars(i));
for b = bases
bb = normalizeName(b);
if contains(name, bb)
idx(end+1) = i; %#ok<AGROW>
m = regexp(name, 'd+$','match','once');
if isempty(m), ids(end+1) = NaN; else, ids(end+1) = str2double(m); end %#ok<AGROW>
break;
end
end
end
end
function s = normalizeName(s)
% 小寫、移除 NBSP/BOM 與一般空白、底線
s = string(s);
s = lower(s);
s = replace(s, char([160 65279]), ''); % NBSP, BOM
s = regexprep(s, 's|_', '');
end
function groups = buildGroups(timeIdx,timeID, pressIdx,pressID, posIdx,posID)
% 若任一類別含有數字後綴,使用數字對齊;否則以出現順序配對
hasID = any(~isnan(timeID)) || any(~isnan(pressID)) || any(~isnan(posID));
groups = struct('id',{},'timeCol',{},'pressCol',{},'posCol',{});
if hasID
IDs = unique([timeID(~isnan(timeID)); pressID(~isnan(pressID)); posID(~isnan(posID))]);
for id = IDs.'
tcol = pickByID(timeIdx,timeID,id);
pcol = pickByID(pressIdx,pressID,id);
xcol = pickByID(posIdx,posID,id);
if ~isempty(tcol) && ~isempty(pcol) && ~isempty(xcol) % 修正:要 isempty(xcol)
groups(end+1) = struct('id',id,'timeCol',tcol,'pressCol',pcol,'posCol',xcol); %#ok<AGROW>
end
end
[ord] = sort([groups.id]); groups = groups(ord); % 修正:取排序索引
else
n = min([numel(timeIdx), numel(pressIdx), numel(posIdx)]);
for k = 1:n
groups(k) = struct('id',k,'timeCol',timeIdx(k),'pressCol',pressIdx(k),'posCol',posIdx(k));
end
end
end
function col = pickByID(idx, ids, id)
j = find(ids==id, 1, 'first');
if isempty(j), col = []; else, col = idx(j); end
end
function x = toNumCol(s)
% 清理常見雜訊(空白、千分位、小數逗號、單位)並轉為 double
if isnumeric(s), x = double(s); return; end
s = string(s);
s = replace(s, [" ", char([160 65279])], "");
hasCommaDecimal = any(contains(s, ",") & ~contains(s, "."));
if hasCommaDecimal
s = replace(s, ".", ""); % 可能是千分點
s = replace(s, ",", "."); % 逗號作為小數點
else
s = replace(s, ",", ""); % 去除千分位逗號
end
s = regexprep(s, "[^d.-+eE]", ""); % 安全正則:保留數字/+-/. /科學記號
x = str2double(s);
end
function out = ternary(cond, a, b)
if cond, out = a; else, out = b; end
end

產出的圖形:




1
2