How to adjust data?

4 visualizaciones (últimos 30 días)
Kacper Suchecki
Kacper Suchecki el 17 de En. de 2021
Comentada: Star Strider el 20 de En. de 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 )

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by