數學式

顯示具有 matlab 標籤的文章。 顯示所有文章
顯示具有 matlab 標籤的文章。 顯示所有文章

2021年5月4日 星期二

Matlab 的table數據使用

 Matlab 的table數據使用

Matlab可用來大量讀數據的function


readtable的使用

讀入數據

t = readtable(filename)

讀入特定範圍數據

T = readtable('filename.xls', 'Range', 'C2:E6', 'ReadVariableNames', false)

觀看table特性

t.Properties

呼叫數據,使用圓括號(),返回值為table,若使用{}則返回cell

t(2, :)

直接使用變數名稱會回傳該Row值,如:t.Variable1

2021年2月23日 星期二

Matlab批次處理excel

最近一直在用matlab,順手紀錄一下,方便未來查閱

批次讀取檔案路徑,好用的函數dir

讀寫excel的函數xlsread、xlswrite


範例

path = 'YourFolderPath';

% return all of files of the folder

Files = dir(strcat(path,'*.xlsx'));

LengthFiles = length(Files);

for i = 1:LengthFiles

%批次讀取檔案

[number, text, rawData] = xlsread(strcat(path,Files(i).name));

end


參考資料:

  1. https://www.mathworks.com/help/matlab/ref/dir.html
  2. https://www.mathworks.com/help/matlab/ref/xlswrite.html
  3. https://www.mathworks.com/help/matlab/ref/xlsread.html

2021年2月6日 星期六

matlab濾波器設計

  1. 選定濾波器與其規格,以下隨意兩項會決定另一項的數值
    • Filter order
    • Transition width
    • Peak passband/stopband ripple
  2. 使用fvtool function檢查濾波器圖形
  3. 檢查Group delay
  4. shift訊號或是選用zero-phase filter來消除Group delay
FIR vs IIR
  • IIR相比FIR有較少的濾波器階數,資源消耗較少
  • IIR的group delay是非線性的
範例:
%Bandpass filter with Passband [50 400], Stopband frequency [45 405], Stopband attenuation [60], Passband Ripple [1000]. 
BPfilt = designfilt('bandpassfir', 'StopbandFrequency1', 45, 'PassbandFrequency1', 50, 'PassbandFrequency2', 400, 'StopbandFrequency2', 405, 'StopbandAttenuation1', 60, 'PassbandRipple', 1, 'StopbandAttenuation2', 60, 'SampleRate', 1000);

fvtool(BPfilt) %檢查濾波器波型
grpdelay(BPfilt) %檢查Group delay

D = mean(grpdelay(BPfilt));% Shift data去補償Group delay的影響 
y = filter(BPfilt,[YourData; zeros(D,1)]);  % 增加D zeros
y = y(D+1:end); 


相關文章:
  • https://www.mathworks.com/help/signal/ref/designfilt.html
  • https://www.mathworks.com/help/signal/ug/practical-introduction-to-digital-filter-design.html
  • https://www.mathworks.com/help/signal/ug/practical-introduction-to-digital-filtering.html
  • https://www.mathworks.com/help/signal/ref/filtfilt.html

不同性別青少年非預期性單腿落地上的生物力學與能量吸收差異

青少年非預期單腿落地跳中的性別差異生物力學和能量吸收:對膝關節損傷力學的影響 Sex-specific landing biomechanics and energy absorption during unanticipated single-leg drop-jumps in...