Good, you paid attention to the last part, where I did same mistake I mentioned to avoid earlier on.
Let me correct time domain answer with the following:
c = x/L
f=sin(n*pi*x/L)
y20=diff(f)
c(end)=[]
c.*y20
y23=c.*y20
y24=diff(y23)
y24=[y24 y24(end)]
plot([1:1:length(y20)-2],y20(1:end-2),'r',[1:1:length(y23)-1],y23(1:end-1),'g',[1:1:length(y24)],y24,'b');grid on
figure(20);plotyy([2:1:150],f(2:150),[2:1:150],diff(c(1:150).*diff(f)/h)/h);grid on;grid minor;axis auto
applying d/dx(c(x)*d/dx(f(x)))=cdot*fdot+c*fdotdot
c2=c
f2=f
c2dot=diff(c2)/h
f2dot=diff(f2)/h
c2(end)=[]
f2(end)=[]
f2dotdot=diff(f2dot)/h
c2(end)=[]
f2(end)=[]
c2dot(end)=[]
f2dot(end)=[]
y=c2dot.*f2dot+c2.*f2dotdot
nc2=[1:1:length(c2)]
figure(1);plot(nc2,c2,nc2,f2,nc2,y)
figure(2);plotyy(nc2,f2,nc2,y)
grid on;grid minor
Now, if you have them off, turn on the following variable descriptors: Range, Min,Max, Mean, Var, Std in MATLAB workspace
y and y24 look alike, but y is the correct output signal.
Now
1.- Regarding you quoting some one that suggests in book loss of 'product rule' because of sampling, and not preserving Hermitian property of the operator (which one, the product?) .. could you please quote book title, ISBN and author(s) so we the readers of your question can read the source?
Is it possible for you to detail the area of application of this equation? is it civil engineering? trying to bring down something? or trying to make something robust enough not to be brought down? is is electronics?
2.- You have chosen a sampling step h, not the readers of your question. I can only work with the data you have supplied. If you want you can increase accuracy by reducing the step size, increasing window of observation of x, f, .. but you, not the readers of your question, chose to work with samples, and then you mention loss of, product rule? of Hermitian operator? What is it you are after, the correct output of your system?
what matrix is it that you want to preserve along the processing of the input signal? if you don't show the bigger picture, it is difficult to help.
3.- we need ..? and click a web link? i don't need to use fft shift, you do. Or you think you do. And it would be kindly appreciated defining the question concisely without waiting to a second round to ask for clicks on literature references that you don't want to mention to the readers of your question. Please define the question correctly, quote book reference details.
4.- Let me show you the symbolic result with MuPAD:
d/dx(c(x))=1/L is a constant, w is a constant, c'f'+cf'' goes f'+cf'' do you agree?
if you really want to preserve Continuous Time properties, then don't use FFT, use DFT or DCT with the right parameters.
FFT is a particular case of DFT that trades off accuracy for processing rate.
Let be F=FT(f) C=FT(c) then FT(f'+cf'') = jwF + FT(cf'')
Do you still really think you must transform to frequency and then back to time to get the function that MuPAD concisely shows?
Then go ahead, write a script that performs
-c*IFT(w*FT(f)) + j*IFT(w*FT(c))^2
and, then, if you want, let us know if it works. The working script would also be appreciated.
If you think that Discrete Time domain is going to deteriorate something that you hold dearly, then don't use it, work in symbolic, but showing up with DT question and then arguing that sampling brings it all down, really, it's disappointing. Make a choice. To be or not to be .. Hamlet?
5.- Just in case not yet noticed, you chose exactly same variable name for the frequency reference vector f and the input function, in my opinion unfortunate choice. Try renaming the input function to something different
Good luck, really, keep us posted.