Plotting inverse Fourier transform function

2 views (last 30 days)
I am trying to see how an input square wave is affected by a transmission line. I have calculated the transmission coefficient, $\Gamma +1$, as a function of $\omega$. I did an inverse Fourier transform to get the function in the time domain using ```Y = ifourier(F, t);``` in MATLAB.
Entire code:
clear all;
close all;
% TRY: Gaussian input test
syms w t x;
% w = [5e3:1000:2e9];
%% Transmission Line parameters
R = 5e-3;
G = 0;
C = 2e-12;
L = 2e-12;
l = 1e-2;
Z_L = 50;
%% T.L. parameters per unit length
Rp = R/l;
Gp = G/l;
Cp = C/l;
Lp = L/l;
%% imaginary number
j = 1i;
%% propogation constant, characteristic impedance, reflection coefficient
g = sqrt((Rp+j*w.*Lp).*(Gp+j*w.*Cp)); %% propogation constant
Z0 = sqrt( (Rp+j*w.*Lp)./ (Gp+j*w.*Cp) );
G = (Z_L - Z0)./(Z_L + Z0); %% Reflection coefficient
F = 1+G;
Y = ifourier(F, t);
y = double(vpa(Y));
fplot(t, y)
My output is
```
Y =
(2*pi*dirac(t) + 50*fourier(1/((1 - 9671406556917033397649408i/(3868562622766813*w))^(1/2) + 50), w, -t) - fourier((1 - 9671406556917033397649408i/(3868562622766813*w))^(1/2)/((1 - 9671406556917033397649408i/(3868562622766813*w))^(1/2) + 50), w, -t))/(2*pi)
```
When I try to use ``` plot(t, Y)``` the following appears:
```
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
```
I try to convert this to double:
```
y = double(Y)
```
But get the following error.
```
y = double(Y)
Error using symengine
Unable to convert expression into
double array.
```
I am stumped here. My goal is to plot this function as in the time domain. If it helps, I used ```syms t w``` to declare my variables in the beginning.
  2 Comments
Walter Roberson
Walter Roberson on 12 Mar 2020
Please post your original equations; perhaps those will help us find a solution.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 13 Mar 2020
With a bit of cleaning up of expressions, you can get to the point where
F = -(2000*2^(1/2)*(1/5000000000 - 1i/(2*w))^(1/2) - 2)/(1000000i/w + 2499/2500)
which is much cleaner than the expression you had.
However, clean expression or dirty expression, you still have the problem that MATLAB does not know how to create an inverse fourier transform of the expression. It can handle parts of it, but there are a couple of parts it cannot figure out, and has to leave as unevaluated transform.
I would have expected to see ifourier() placeholders rather than fourier(), but an identity is being used:
fourier(fourier(t,t,w),w,t) = -2*pi*t
so instead of using a ifourier() placeholder, it can be expressed as a fourier() placeholder with appropriate multiplier.
  4 Comments
Walter Roberson
Walter Roberson on 13 Mar 2020
Y =
((10000*pi*dirac(t))/2499 - 2000*2^(1/2)*fourier((1/5000000000 - 1i/(2*w))^(1/2)/(1000000i/w + 2499/2500), w, -t) + (12500000000000*pi*exp((2500000000*t)/2499)*(sign(t) - 1))/6245001)/(2*pi)
Notice that even though Y was created with an ifourier() call, that it involves expressions in fourier() rather than expressions in ifourier() . Normally when one of the symbolic routines is not able to figure out what the answer is, it returns a placeholder in terms of the same function. For example,
>> int(t^t)
ans =
int(t^t, t)
It could not figure out how to do the integral so it returned a placeholder in terms of the function that was called, namely int() in this case.
So we have to wonder, why did ifourier() return a result in terms of fourier() instead of a result in terms of ifourier() ? Is it a bug? The place where it has
fourier((1/5000000000 - 1i/(2*w))^(1/2)/(1000000i/w + 2499/2500), w, -t)
was that just an problem in the code, and should it say
ifourier((1/5000000000 - 1i/(2*w))^(1/2)/(1000000i/w + 2499/2500), w, -t)
instead?
The answer is that there turns out to be an identity (not "identifier") connecting fourier() and ifourier(). It is sort of like if you asked to process an expression involving sin(x)^2 and it gave you a result in terms of 1-cos(x)^2 instead -- it might be unexpected, but it turns out to be mathematically correct: ifourier(expression) can be written in terms of fourier(expression)
So where
Y =
((10000*pi*dirac(t))/2499 - 2000*2^(1/2)*fourier((1/5000000000 - 1i/(2*w))^(1/2)/(1000000i/w + 2499/2500), w, -t) + (12500000000000*pi*exp((2500000000*t)/2499)*(sign(t) - 1))/6245001)/(2*pi)
you should understand this as:
expression that was successfully ifourier, plus the inverse transform of something that is written using the mathematical relationship between ifourier() and fourier()
You do not have to do anything with the mathematical identity, other than recognize that where Y contains a call to fourier(), that that is a mathematical way of writing an ifourier() for something that MATLAB does not know how to take the inverse fourier transform of.
Also what is -2*pi*t
I was demonstrating the mathematical relationship between fourier() and ifourier(): that where
ifourier(fourier(F(t),t,w),w,t)
would be expected to produce F(t), that it is mathematically correct for it to internally treat the call as if you had requested
fourier(fourier(F(t), t, w)/(-2*pi),w,t)
Just the same way that it would be valid for MATLAB to substitute 1-cos(t)^2 in a place where you expected to see sin(t)^2.
Also how do I plot the final expression?
You cannot plot it -- MATLAB is not able to find the answer for you. It is not the fault of MATLAB: the expression does not appear to have a closed form inverse transform. Maple cannot find the solution either.
In order to do any plotting, you would need to use numeric approximations. Unfortunately it turns out that the basic expression oscillates infinitely often, and does not converge.
Anurag Agarwal
Anurag Agarwal on 4 Apr 2020
I was facing the same issue and could not solve. So as you are suggesting of using numerical techniques, do you mean FFT, if yes what is the values of w be chosen for given time range?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!