How to adjust data?

4 次查看(过去 30 天)
Hi,
I need help. I had get data of signal but it doesnt seems good. I want to have straight signal with limit 200 on below and up to 1100 on the top, by only adjusting him not cuting.
I tried something like this .
for x 1:5000005
if x<40000
wspolrzedna(x)=wspolrzedna(x)-100;
end
if x<100000 & x>40000
wspolrzedna(x)=wspolrzedna(x)+200;
end
if x<300000 & x>100000
wspolrzedna(x)=wspolrzedna(x)+300;
end
if x<500000 & x>300000
wspolrzedna(x)=wspolrzedna(x)+500;
end
if x<750000 & x>500000
wspolrzedna(x)=wspolrzedna(x)+750;
end
if x<1000000 & x>750000
wspolrzedna(x)=wspolrzedna(x)+1000;
end
end
I get only something like this. I please for help. Thanks. (The plots plots are built in time scale , the code was write using samples. I have 5000005 samples which i want adjust )

采纳的回答

Star Strider
Star Strider 2021-1-17
It would be easiest to use the detrend function:
t = linspace(0, 100, 1E+4); % Create Data
s = sin(2*pi*t) + 0.001*(t-50).^2; % Create Data
figure
plot(t,s)
grid
s_det = detrend(s, 3); % Detrend Using 3° Polynomial
figure
plot(t, s_det)
grid
.
  2 个评论
Kacper Suchecki
Kacper Suchecki 2021-1-20
Thanks. It's work pretty well.
Star Strider
Star Strider 2021-1-20
As always, my pleasure!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by