Hi,
I understand that you are facing an issue while fitting a curve to the given data.
As per the given data, output of the fitting function is "NaN" because the "period" variable in the attached ".mat" file contains repetitive values. Define the "period" variable using "linspace" function as shown in the example below.
period = linspace(0,5000,16385);
Use "polyfit" function to fit an approximate "n" degree polynomial to the data.
p = polyfit(period,smd,50); % fitting a 50 degree polynomial
Refer to the following documentation to learn more about "polyfit" function.
Obtain the fitted curve using "polyval" function.
y = polyval(p,period);
Refer to the following documentation to learn more about "polyval" function.
Hope it helps!