Smooth a curve or increasing the resolution?

조회 수: 14 (최근 30일)
Tay
Tay 2021년 8월 4일
댓글: Stephen23 2021년 11월 24일
Hello !!
I read data from an instrument (ILX Lightwave TEC) that gives me current values and I plot against time, but my curve saturates at times. I think this might be a resolution problem.
I would like to smooth the curve.
I tried using the slidingavg function, but it doesn't seem right.
clear all
y = load('ILX_TEC_curr.txt');
x = load('ILX_TEC_time.txt');
N = 10;
ys = slidingavg(y, N);
hfig4=figure(4);
plot(x,y,x,ys,'-o');
xlabel('Time (s)','fontsize',18,'fontweight','bold');
ylabel('Sample TEC Current (A)','fontsize',18,'fontweight','bold');
Is there another form or function that can help me smooth the first result (first curve - blue line)?
Attached here are the data if that helps.
Thank you.
Tay

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 8월 4일
You may consider using a moving average filter smoothdata() with sgolay, for instance.
  댓글 수: 3
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 8월 4일
Before making a final decision, play with the settings of these filters and also test movmean(). And compare them. The problem here is the quality of your acquired data. It looks like your data was not collected on a fixed smapling time.
Tay
Tay 2021년 8월 4일
What do you mean by fixed sampling time?
I collect the current value each time using for loop.
Something like this
loop_end = 6000;
for i = 1:loop_end
ILX_TEC_time(i) = toc; %cpu elasped time
ILX_TEC_curr(i) = str2double(query(ILX_obj,'TEC:ITE?')); %read ILX TEC current
end
Then I plot current x time aquired.
Will have a look to the movmean() function also :D

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Smoothing에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by