フィルターのクリア

make my curve smooth

1 回表示 (過去 30 日間)
fouad koudsi
fouad koudsi 2019 年 8 月 5 日
回答済み: Star Strider 2019 年 8 月 6 日
Hello,
Due to low sample rate my curve is not coming smooth, so I want to make it smooth
This is the code I am writting:
filename = 'All Data_10mm.xlsx';
%
sheet = '10 mm_1hz_0V_Test1'; % add sheet number
xlRange = 'B80:B101'; % X range
ylRange = 'E80:E101'; % Y range
[Disp, text, raw]= xlsread(filename,sheet,xlRange);
[force, text, raw]= xlsread(filename,sheet,ylRange);
plot(Disp,force,'-r')
hold all
grid on
grid minor
  2 件のコメント
Rik
Rik 2019 年 8 月 5 日
Have you looked at the spline function?
Adam Danz
Adam Danz 2019 年 8 月 5 日
編集済み: Adam Danz 2019 年 8 月 5 日

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2019 年 8 月 6 日
This is as close as I can get to what you want:
filename = 'All Data_10mm.xlsx';
sheet = '10 mm_1hz_0V_Test1'; % add sheet number
xlRange = 'B80:B101'; % X range
ylRange = 'E80:E101'; % Y range
[Disp, text, raw]= xlsread(filename,sheet,xlRange);
[force, text, raw]= xlsread(filename,sheet,ylRange);
plot(Disp,force,'-r')
hold all
grid on
grid minor
[minx,idx1] = mink(Disp,3);
[maxx,idx2] = maxk(Disp,2);
idxv = sort([idx1; idx2]);
for k = 1:numel(idxv)-1
xi = [idxv(k), idxv(k+1)];
Dispv(k,:) = linspace(Disp(xi(1)), Disp(xi(2)), 150);
% qx = Disp(xi(1):xi(2))
% qy = force(xi(1):xi(2))
forcev(k,:) = interp1(Disp(xi(1):xi(2)), force(xi(1):xi(2)), Dispv(k,:), 'pchip');
end
figure
plot(Dispv', forcev')
grid
title('‘pchip’ Interpolation')
producing:
make my curve smooth - 2019 08 05.png
Feel free to experimant with it.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSmoothing についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by