+ All Categories
Home > Documents > Fractional Calculus George

Fractional Calculus George

Date post: 09-Jan-2016
Category:
Upload: george-papazafeiropoulos
View: 40 times
Download: 0 times
Share this document with a friend
Description:
matlab codes and functions for fractional calculus through Fourier series

of 12

Transcript
  • Diskussion Fraktionale Differentialgleichungen Seite 20/3131

    (d) Using modified Fourier SeriesThe modification has been done as follows:

    Firstly, the Fourier Series approximation of the original signal is solved using exactlythe previous method.

    After that, the Fourier Series approximation was filtered to remove the extreme va-lues. A threthold has been taken as follows:

    RMSE =

    1n

    nt=1

    e2t ,

    et = ReconstructedFunctionOriginalFunction

    If the individual error is larger than RMSE2 , the time instant which causes the errorwill be replaced with the coresponding time instant of the original signal.

    After that, the filtered Fourier Series coefficients were again reconstructed from thefiltered signal and were used to find the required partial derivative using the Eq (1)of the previous section.

    Matlab Function:

    1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 %INPUT3 %-----4 % - f : The required function. f must be defined for [t0,t0+T]5 % - T : period of the function6 % - M : number of frequencies (default: 50)7 %--------------------------------------------------------------------------8 function

    [ReturnedValue1,ReturnedValue2,ReturnedValue6,ReturnedValue3,ReturnedValue4, ...

    9 ReturnedValue7,ReturnedValue5] = Fractional_Derivative_Fourier_Series_Complete ...

    10 (FunctionToBeDerivedInStringX, Beginning_Point, End_Point, RequiredDerivative)

    11 %--------------------------------------------------------------------------12

    13 %--------------------------------------------------------------------------14 N = 100; % Number of points per period15 M = 50; % Should be half of N16 InputFunction = FunctionToBeDerivedInStringX;17 t0 = Beginning_Point;18 T = End_Point - Beginning_Point;19 q = RequiredDerivative;20 w0 = 2*pi/T;21 t = linspace(t0,T,N);22 %--------------------------------------------------------------------------

    The code of this function was inspired/excerpted/modified by/from both Guilherme Coco fourier_coeff Beltra-mini and George Papazafeiropoulos fourier_diffint

  • Diskussion Fraktionale Differentialgleichungen Seite 21/3131

    23

    24 %--------------------------------------------------------------------------25 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Another Way %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%26 fun = inline(InputFunction,x);27 U = fun(t);28

    29 A0_New = 1/T*quadl(fun,t0,t0+T);30

    31 coeff_New(2*M+1,1) = 0; % Initialization32 coeff_New(1) = A0_New;33

    34 f_aux = inline([( InputFunction ) .*cos(w0*m*x)],x,m,w0);35 for m=1:M36 coeff_New(m+1) = quadl(f_aux,t0,t0+T,[],[],m,w0);37 end38

    39 f_aux = inline([( InputFunction ) .*sin(w0*m*x)],x,m,w0);40 for m=1:M41 coeff_New(m+M+1) = quadl(f_aux,t0,t0+T,[],[],m,w0);42 end43 coeff_New(2:end) = 2/T * coeff_New(2:end);44

    45 %--------------------------------------------------------------------------46

    47 %%%%%%%%%%%%%%% Reconstruct the Signal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%48

    49 Fourier_Series = zeros(N,2*M+1); % Initialization50 Fourier_Series(:,1) = 1;51 for m=2:M+152 Fourier_Series(:,m) = cos(w0*(m-1)*t);53 Fourier_Series(:,m+M) = sin(w0*(m-1)*t);54 end55 Function_Reconstructed = Fourier_Series*reshape(coeff_New,2*M+1,1);56 ReturnedValue1 = Function_Reconstructed;57

    58 %--------------------------------------------------------------------------59 %%%%%%%%%%%%%%%%%%%%%% Perform filteration of extreme values %%%%%%%%%%%%%%60 %--------------------------------------------------------------------------61

    62 Error_Method2 = sqrt(mean((Function_Reconstructed - U).^2));63

    64 ErrorVector_Method2 = zeros(1, length(t));65

    66 for i = 1 : length(t)67

    68 ErrorVector_Method2(i) = sqrt((Function_Reconstructed(i) - U(i)).^2);69 end70

    71

    72 Function_Reconstructed_filtered = Function_Reconstructed;73 Indecies1 = find(ErrorVector_Method2 > Error_Method2/2);74 Function_Reconstructed_filtered(Indecies1) = U(Indecies1);75

    76 Error_Method2_New = sqrt(mean((Function_Reconstructed_filtered - U).^2));77 ReturnedValue2 = Error_Method2_New;

  • Diskussion Fraktionale Differentialgleichungen Seite 22/3131

    78 ReturnedValue6 = ErrorVector_Method2;79

    80 %--------------------------------------------------------------------------81 %%%%%%%%%%%% Recover Fourier Coefficients of Filtered Signal %%%%%%%%%%%%%%82 %--------------------------------------------------------------------------83

    84 Fourier_Series_Method2 = Fourier_Series \ Function_Reconstructed_filtered;85

    86 A0_New_filtered = Fourier_Series_Method2(1);87 An_New_filtered = Fourier_Series_Method2(2 : M+1);88 Bn_New_filtered = Fourier_Series_Method2(M+2 : 2*M+1);89 coeff_New_filtered = [A0_New_filtered ; An_New_filtered ; Bn_New_filtered];90

    91 %--------------------------------------------------------------------------92 %%%%%%%%%%%%%%%%%% Reconstruct filted signals %%%%%%%%%%%%%%%%%%%%%%%%%%%%%93

    94 Fourier_Series_filtered = zeros(N,2*M+1); % Initialization95 Fourier_Series_filtered(:,1) = 1;96 for m=2:M+197 Fourier_Series_filtered(:,m) = cos(w0*(m-1)*t);98 Fourier_Series_filtered(:,m+M) = sin(w0*(m-1)*t);99 end

    100

    101 Function_Reconstructed_filtered_reconstruct = Fourier_Series_filtered*reshape(coeff_New_filtered,2*M+1,1);

    102 ReturnedValue3 = Function_Reconstructed_filtered_reconstruct;103

    104 ErrorVector_Method_Reconstructed = zeros(1, length(t));105

    106 for i = 1 : length(t)107

    108 ErrorVector_Method_Reconstructed(i) = sqrt((Function_Reconstructed_filtered_reconstruct(i) - U(i)).^2);

    109 end110

    111 Reconstruction_Error_Method2 = sqrt(mean((Function_Reconstructed_filtered_reconstruct - U).^2));

    112 ReturnedValue4 = Reconstruction_Error_Method2;113 ReturnedValue7 = ErrorVector_Method_Reconstructed;114

    115 %--------------------------------------------------------------------------116 %%%%%%%%%%%%%%%%%%%%% Calculate the Partial Derivative %%%%%%%%%%%%%%%%%%%%117

    118 A0_Fourier = A0_New_filtered/(gamma(1 - q) + eps);119

    120

    121 n = length(An_New_filtered);122 KK = (1:n) * w0;123 ZZ = (q * pi)/2;124 % replicate data appropriately125 eval_t = t(:,ones(1,n));126 eval_n = KK(:,ones(1,length(t)));127 eval_An = An_New_filtered(:,ones(1,length(t)));128 eval_Bn = Bn_New_filtered(:,ones(1,length(t)));129

  • Diskussion Fraktionale Differentialgleichungen Seite 23/3131

    130 % differintegral131 Y2_Der = A0_Fourier .* (t + eps).^(-q) + sum((eval_n +

    eps).^(q).*(eval_An.*cos(eval_n.*eval_t + ZZ) + eval_Bn.*sin(eval_n.*eval_t + ZZ)),2);

    132

    133 ReturnedValue5 = Y2_Der;134 %--------------------------------------------------------------------------

    Example (1): f(x) = sin(x)

    1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 % This example applies the modified Fourier Series and Then derives it3

    4 clear all;clc;5 figure6 t = linspace(0,2*pi,100);7 InputFunction = sin(x);8 fun = inline(InputFunction,x);9 U = fun(t);

    10 alphaX = -10 : 1 : 10;11 cc = jet(length(alphaX));12 N = 0;13

    14

    15 for alpha = -10 : 1 : 1016 [Y1,Error_Between_Filted_And_Original,Error_Filted_And_Original_Vector, ...17 Y3,Error_Recons_Signal_After_Filterat_And_Original, ...18 Error_Recons_Signal_After_Filterat_And_Original_Vector,Y5] = ...19 Fractional_Derivative_Fourier_Series_Complete(InputFunction, 0, 2*pi,

    alpha/10);20 if(length(Y5) == 1)21 Y5(1:length(X)) = Y5(length(Y5));22 else23 %do nothing24 end25 if(alpha == -10 || alpha == 0 || alpha == 10)26 N = 2.5;27 else28 N = 1.5;29 end30 plot(t,Y5,LineWidth,N,color,cc(alpha+11,:));hold on31 end32

    33 set(gca,xTick,0:pi/2:2*pi)34 set(gca,xTickLabel,{0,\pi/2,\pi,3\pi/2,2\pi})35

    36 xlabel(x,fontsize,14,Interpreter,latex);37 ylabel($ y = d^{\alpha} f(x) / d

    x^{\alpha}$,fontsize,14,Interpreter,latex);38 title(Fractional derivatives of $f(x) = sin(x)$ of order $\alpha = 0, 0.1,

    ..., 0.2, 1.0$,fontsize,14,Interpreter,latex)39

    40

    41 h = legend($\alpha = -1$, $\alpha = -0.9$, $\alpha = -0.8$, $\alpha =

  • Diskussion Fraktionale Differentialgleichungen Seite 24/3131

    -0.7$, $\alpha = -0.6$, $\alpha = -0.5$, $\alpha = -0.4$, $\alpha = -0.3$, $\alpha = -0.2$, $\alpha = -0.1$, ...

    42 $\alpha = 0$, $\alpha = 0.1$, $\alpha = 0.2$, $\alpha = 0.3$, $\alpha = 0.4$, $\alpha = 0.5$, $\alpha = 0.6$, $\alpha = 0.7$, $\alpha = 0.8$, $\alpha = 0.9$, $\alpha = 1$);

    43 set(h,Interpreter,latex);grid on44

    45 text(1.57,-0.4,$y = cos(x)$,fontsize,14,color,cc(10+11,:),Interpreter,latex)

    46 text(3.35,0.8,$y = -cos(x)$,fontsize,14,color,cc(-10+11,:),Interpreter,latex)

    47 text(3.35,0.2,$y = sin(x)$,fontsize,14,color,cc(0+11,:),Interpreter,latex)

    48

    49 figure;50 plot(t,U,LineWidth,2)51 hold on52 plot(t,Y3,r.,LineWidth,2)53 grid on54 set(gca,xTick,0:pi/2:2*pi)55 set(gca,xTickLabel,{0,\pi/2,\pi,3\pi/2,2\pi})56

    57 xlabel(x,fontsize,14,Interpreter,latex);58 ylabel($ y = sin(x)$,fontsize,14,Interpreter,latex);59 title(Fourier Series approximation of $f(x) = sin(x)$, Extreme values are

    filtered,fontsize,14,Interpreter,latex)60 h2 = legend($Original$, $Approximation$);61 set(h2,Interpreter,latex);62

    63 figure;64 plot(t,Error_Filted_And_Original_Vector,LineWidth,2)65 hold on66 plot(t,Error_Recons_Signal_After_Filterat_And_Original_Vector,r.,LineWidth,2)67 grid on68

    69 xlabel(x,fontsize,14,Interpreter,latex);70 ylabel($\sqrt{\frac{1}{n}\sum_{t=1}^{n}e_t^2}$,fontsize,14,Interpreter,latex);71 title(Root mean squared Error between Original signal and Fourier Series

    approximation,fontsize,14,Interpreter,latex)72 h3 = legend($Before Filtration$, $After Filtration$);73 set(h3,Interpreter,latex);

  • Diskussion Fraktionale Differentialgleichungen Seite 25/3131

    0 pi2

    pi 3pi2

    2pi1.5

    1

    0.5

    0

    0.5

    1

    1.5

    y = cos(x)

    y = cos(x)

    y = sin(x)

    x

    y=df(x

    )/dx

    Fractional derivatives of f(x) = sin(x) of order = 1,0.9, ..., 0.9, 1.0

    = 1 = 0.9 = 0.8 = 0.7 = 0.6 = 0.5 = 0.4 = 0.3 = 0.2 = 0.1 = 0

    = 0.1

    = 0.2

    = 0.3

    = 0.4

    = 0.5

    = 0.6

    = 0.7

    = 0.8

    = 0.9

    = 1

    Abbildung 7: Fractional Derivative Calculation using modified Fourier Series. Very powerful me-thod, works for all R. Works perfectly for periodic functions, however, within non periodicfunctions Gibbs phenomenon will make the result little poor!

    0 pi2

    pi 3pi2

    2pi1

    0.8

    0.6

    0.4

    0.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    x

    y=sin(x

    )

    Fourier Series approximation of f(x) = sin(x), Extreme values are filtered

    Original

    Fourier Series Approximation

    0 pi2

    pi 3pi2

    2pi0

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    1.4

    1.6

    1.8109

    x

    1 nn t=

    1e2 t

    Root mean squared Error between Original signal and Fourier Series approximation

    Before Filtration

    After Filtration

    Abbildung 8: Modified Fourier Series approximation of f(x) = sin(x) where the extreme valuesare filtered based on Root Mean Squared Error threshold.

  • Diskussion Fraktionale Differentialgleichungen Seite 26/3131

    Example (2): f(x) = x*(x pi)*(x 2*pi)

    1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 % This example applies the modified Fourier Series and Then derives it3

    4 clear all;clc;5 figure6 t = linspace(0,2*pi,100);7 InputFunction = x.*(x - pi).*(x - 2*pi);8 fun = inline(InputFunction,x);9 U = fun(t);

    10 alphaX = -10 : 1 : 10;11 cc = jet(length(alphaX));12 N = 0;13

    14 %%15 for alpha = -10 : 1 : 1016 [Y1,Error_Between_Filted_And_Original,Error_Filted_And_Original_Vector, ...17 Y3,Error_Recons_Signal_After_Filterat_And_Original, ...18 Error_Recons_Signal_After_Filterat_And_Original_Vector,Y5, ...19 Threshold] = Fractional_Derivative_Fourier_Series_Complete ...20 (InputFunction, 0, 2*pi, alpha/10);21 if(length(Y5) == 1)22 Y5(1:length(t)) = Y5(length(Y5));23 else24 %do nothing25 end26 if(alpha == -10 || alpha == 0 || alpha == 10)27 N = 2.5;28 else29 N = 1.5;30 end31 plot(t,Y5,LineWidth,N,color,cc(alpha+11,:));hold on32 end33 %%34 set(gca,xTick,0:pi/2:2*pi)35 set(gca,xTickLabel,{0,\pi/2,\pi,3\pi/2,2\pi})36

    37 xlabel(x,fontsize,14,Interpreter,latex);38 ylabel($ y = d^{\alpha} f(x) / d x^{\alpha}$,fontsize,14,Interpreter, ...39 latex);40 title(Fractional derivatives of $f(x) = x*(x - pi)*(x - 2*pi)$ of order

    $\alpha = -1, -0.9, ..., 0.9, 1.0$,fontsize,14,Interpreter,latex)41

    42

    43 h = legend($\alpha = -1$, $\alpha = -0.9$, $\alpha = -0.8$, $\alpha = -0.7$, $\alpha = -0.6$, $\alpha = -0.5$, $\alpha = -0.4$, $\alpha = -0.3$, $\alpha = -0.2$, $\alpha = -0.1$, ...

    44 $\alpha = 0$, $\alpha = 0.1$, $\alpha = 0.2$, $\alpha = 0.3$, $\alpha = 0.4$, $\alpha = 0.5$, $\alpha = 0.6$, $\alpha = 0.7$, $\alpha = 0.8$, $\alpha = 0.9$, $\alpha = 1$);

    45 set(h,Interpreter,latex);grid on46

    47 % text(1.57,-0.4,$y =

  • Diskussion Fraktionale Differentialgleichungen Seite 27/3131

    cos(x)$,fontsize,14,color,cc(10+11,:),Interpreter,latex)48 % text(3.35,0.8,$y =

    -cos(x)$,fontsize,14,color,cc(-10+11,:),Interpreter,latex)49 % text(3.35,0.2,$y =

    sin(x)$,fontsize,14,color,cc(0+11,:),Interpreter,latex)50

    51 figure;52 plot(t,U,LineWidth,1.5)53 hold on54 plot(t,Y3,r.,LineWidth,1)55 grid on56 set(gca,xTick,0:pi/2:2*pi)57 set(gca,xTickLabel,{0,\pi/2,\pi,3\pi/2,2\pi})58

    59 xlabel(x,fontsize,14,Interpreter,latex);60 ylabel($ f(x) = x*(x - pi)*(x - 2*pi)$,fontsize,14,Interpreter,latex);61 title(Fourier Series approximation. Extreme values are

    filtered,fontsize,14,Interpreter,latex)62 h2 = legend($Original$, $Approximation$);63 set(h2,Interpreter,latex);64

    65 figure;66 plot(t,Error_Filted_And_Original_Vector,LineWidth,1.5)67 hold on68 plot(t,Error_Recons_Signal_After_Filterat_And_Original_Vector,r.,LineWidth,1)69 hold on70 Threshold(1:length(t)) = Threshold(length(Threshold));71 plot(t,Threshold,g-,LineWidth,1);grid on72

    73 xlabel(x,fontsize,14,Interpreter,latex);74 ylabel($\sqrt{\frac{1}{n}\sum_{t=1}^{n}e_t^2}$,fontsize,14,Interpreter,latex);75 title(Root mean squared Error between Original signal and Fourier Series

    approximation,fontsize,14,Interpreter,latex)76 h3 = legend($Before Filtration$, $After Filtration$);77 set(h3,Interpreter,latex);

    1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 syms x;3 Y = x.*(x - pi).*(x - 2*pi);4 t = linspace(0,2*pi,100); % As defined in the fractional calculus function5

    6 %------ alpha = 0, 0th fractional derivative ------------------------------7 U = subs(Y,x,t);8 plot(t,U,b.); hold on9

    10 %------ alpha = 1, 1st fractional derivative / normal derivative ----------11 R = diff(Y,x);12 R_X = subs(R,x,t);13 plot(t,R_X,b.); hold on14

    15 %----- alpha = -1, -1st fractional derivative / normal integration --------16 RR = int(Y,x);17 RR_X = subs(RR,x,t);18 plot(t,RR_X,r.); grid on

  • Diskussion Fraktionale Differentialgleichungen Seite 28/3131

    0 pi2

    pi 3pi2

    2pi15

    10

    5

    0

    5

    10

    15

    20

    25

    Seems to beshifted above!

    x

    y=df(x

    )/dx

    Fractional derivatives of f(x) = x (x pi) (x 2 pi) of order = 1,0.9, ..., 0.9, 1.0

    = 1 = 0.9 = 0.8 = 0.7 = 0.6 = 0.5 = 0.4 = 0.3 = 0.2 = 0.1 = 0

    = 0.1

    = 0.2

    = 0.3

    = 0.4

    = 0.5

    = 0.6

    = 0.7

    = 0.8

    = 0.9

    = 1

    Abbildung 9: Fractional Derivative Calculation using modified Fourier Series.

    0 pi2

    pi 3pi2

    2pi15

    10

    5

    0

    5

    10

    15

    x

    f(x

    )=x(xpi)(x

    2pi)

    Fourier Series approximation. Extreme values are filtered

    Original

    Fourier Series Approximation

    0 pi2

    pi 3pi2

    2pi0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    1103

    x

    1 nn t=

    1e2 t

    Root mean squared Error between Original signal and Fourier Series approximation

    Before Filtration

    After Filtration

    Threshold

    Abbildung 10: Modified Fourier Series approximation of f(x) = x (x pi) (x 2 pi) wherethe extreme values are filtered based on Root Mean Squared Error threshold.

  • Diskussion Fraktionale Differentialgleichungen Seite 29/3131

    Example (3): f(x) = x

    1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 %%%%%%%%% My Fourier Series Function With Enhancement & Filteration %%%%%%%3

    4 % This example applies the modified Fourier Series and Then derives it5

    6 tic7 clear all;clc;8 figure9 t = linspace(0,2*pi,100);

    10 InputFunction = x;11 fun = inline(InputFunction,x);12 U = fun(t);13 alphaX = -10 : 1 : 10;14 cc = jet(length(alphaX));15 N = 0;16

    17 %%18 for alpha = -10 : 1 : 1019 [Y1,Error_Between_Filted_And_Original,Error_Filted_And_Original_Vector, ...20 Y3,Error_Recons_Signal_After_Filterat_And_Original, ...21 Error_Recons_Signal_After_Filterat_And_Original_Vector,Y5, ...22 Threshold] = Fractional_Derivative_Fourier_Series_Complete ...23 (InputFunction, 0, 2*pi, alpha/10);24

    25 if(length(Y5) == 1)26 Y5(1:length(t)) = Y5(length(Y5));27 else28 %do nothing29 end30 if(alpha == -10 || alpha == 0 || alpha == 10)31 N = 2.5;32 else33 N = 1.5;34 end35 plot(t,Y5,LineWidth,N,color,cc(alpha+11,:));hold on36 end37 %%38

    39 set(gca,xTick,0:pi/2:2*pi)40 set(gca,xTickLabel,{0,\pi/2,\pi,3\pi/2,2\pi})41

    42 xlabel(x,fontsize,14,Interpreter,latex);43 ylabel($ y = d^{\alpha} f(x) / d

    x^{\alpha}$,fontsize,14,Interpreter,latex);44 title(Fractional derivatives of $f(x) = x$ of order $\alpha = -1, -0.9, ...,

    0.9, 1.0$,fontsize,14,Interpreter,latex)45

    46

    47 h = legend($\alpha = -1$, $\alpha = -0.9$, $\alpha = -0.8$, $\alpha = -0.7$, $\alpha = -0.6$, $\alpha = -0.5$, $\alpha = -0.4$, $\alpha = -0.3$, $\alpha = -0.2$, $\alpha = -0.1$, ...

    48 $\alpha = 0$, $\alpha = 0.1$, $\alpha = 0.2$, $\alpha = 0.3$,

  • Diskussion Fraktionale Differentialgleichungen Seite 30/3131

    $\alpha = 0.4$, $\alpha = 0.5$, $\alpha = 0.6$, $\alpha = 0.7$, $\alpha = 0.8$, $\alpha = 0.9$, $\alpha = 1$);

    49 set(h,Interpreter,latex);grid on50

    51 % text(1.57,-0.4,$y = cos(x)$,fontsize,14,color,cc(10+11,:),Interpreter,latex)

    52 % text(3.35,0.8,$y = -cos(x)$,fontsize,14,color,cc(-10+11,:),Interpreter,latex)

    53 % text(3.35,0.2,$y = sin(x)$,fontsize,14,color,cc(0+11,:),Interpreter,latex)

    54

    55 figure;56 plot(t,U,LineWidth,1.5)57 hold on58 plot(t,Y3,r.,LineWidth,1)59 grid on60 set(gca,xTick,0:pi/2:2*pi)61 set(gca,xTickLabel,{0,\pi/2,\pi,3\pi/2,2\pi})62

    63 xlabel(x,fontsize,14,Interpreter,latex);64 ylabel($ f(x) = x$,fontsize,14,Interpreter,latex);65 title(Fourier Series approximation. Extreme values are

    filtered,fontsize,14,Interpreter,latex)66 h2 = legend($Original$, $Approximation$);67 set(h2,Interpreter,latex);68

    69 figure;70 plot(t,Error_Filted_And_Original_Vector,LineWidth,1.5)71 hold on72 plot(t,Error_Recons_Signal_After_Filterat_And_Original_Vector,r.,LineWidth,1)73 hold on74 Threshold(1:length(t)) = Threshold(length(Threshold));75 plot(t,Threshold,g-,LineWidth,1);grid on76

    77 xlabel(x,fontsize,14,Interpreter,latex);78 ylabel($\sqrt{\frac{1}{n}\sum_{t=1}^{n}e_t^2}$,fontsize,14,Interpreter,latex);79 title(Root mean squared Error between Original signal and Fourier Series

    approximation,fontsize,14,Interpreter,latex)80 h3 = legend($Before Filtration$, $After Filtration$);81 set(h3,Interpreter,latex);82 toc

  • Diskussion Fraktionale Differentialgleichungen Seite 31/3131

    0 pi2

    pi 3pi2

    2pi15

    10

    5

    0

    5

    10

    15

    20

    25

    x

    y=df(x

    )/dx

    Fractional derivatives of f(x) = x of order = 1,0.9, ..., 0.9, 1.0

    = 1 = 0.9 = 0.8 = 0.7 = 0.6 = 0.5 = 0.4 = 0.3 = 0.2 = 0.1 = 0

    = 0.1

    = 0.2

    = 0.3

    = 0.4

    = 0.5

    = 0.6

    = 0.7

    = 0.8

    = 0.9

    = 1

    Abbildung 11: Fractional Derivative Calculation using modified Fourier Series. Modification stilldoes not work as required!

    0 pi2

    pi 3pi2

    2pi0

    1

    2

    3

    4

    5

    6

    7

    x

    f(x

    )=x

    Fourier Series approximation. Extreme values are filtered

    Original

    Approximation

    0 pi2

    pi 3pi2

    2pi0

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    x

    1 nn t=

    1e2 t

    Root mean squared Error between Original signal and Fourier Series approximation

    Before Filtration

    After Filtration

    Abbildung 12: Modified Fourier Series approximation of f(x) = x where the extreme values arefiltered based on Root Mean Squared Error threshold.


Recommended