Hello there :)
I have created the following trend:
This is the script I have used to for that:
clear;
close all;
Fs = 2;
Ts = 1/Fs;
t =0:Ts:30;
t_1 = t(1,1:((3/Ts)));
t_2 = t(1,((3/Ts)+1):((16/Ts)));
t_3 = t(1,((16/Ts+1)):((19/Ts)));
t_4 = t(1,((19/Ts+1)):end);
trapez_1 = trapmf(t_1,[.5 1 2 2.5]);
trapez_2 = (trapmf(t_2,[3 3.5 4.5 5]))*-1;
trapez_3 = (trapmf(t_3,[16.5 17 18 18.5]))*-1;
trapez_4 = (trapmf(t_4,[19 19.5 20.5 21]));
signal = [trapez_1 trapez_2 trapez_3 trapez_4];
plot (t,signal);
xlabel('x');
ylabel('y');
title ('Nonlinearity');
grid on;
I would like to create a nonlinear trend for the marked areas on the picture above (I've only marked the first area for example). For this purpose, I would like to use a cubical function to create a nonlinear trend between the stationary areas. From my point of view, the way to do this is define a cubical function and add it to the areas, where a linear trend exists.
Is there any trick to do this with the created trapezoidal signal? I need to remain the rest of the signal as it is right now (that's what makes it tricky for me...)
I would be really thankful for any help :)
Thanks in advance.
Best regards, Niko