How to adjust data?

4 Ansichten (letzte 30 Tage)
Kacper Suchecki
Kacper Suchecki am 17 Jan. 2021
Kommentiert: Star Strider am 20 Jan. 2021
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 )

Akzeptierte Antwort

Star Strider
Star Strider am 17 Jan. 2021
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 Kommentare
Kacper Suchecki
Kacper Suchecki am 20 Jan. 2021
Thanks. It's work pretty well.
Star Strider
Star Strider am 20 Jan. 2021
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by