What’s the correct syntax to set-up discrete convolution ?
I am trying to generate a 1-D discrete convolution data-set but I keep getting NaN values. I am wondering what’s going wrong. I want to convolve the function "differentiated_green" with the function "f" with respect to the variable "x".
These are the common parameters needed for complete definition of both the functions:
M = 0.5; alpha = log(2)/2; epsilon = 0.5; f = 1/30; omega = 2*pi*f; c_inf = 340; k = omega/c_inf; t = 270; nodes = 401;
y = 0;
x_start = -200; x_end = 200;
length = x_end – x_start;
x = linspace(x_start,x_end,nodes);
This is the definition of the function "f":
f = epsilon * exp( -alpha * x.^2);
This is the definition of the function "differentiated_green":
A = omega/( 4 * (c_inf^2)*sqrt(1-M^2));
B = besselh(0, (k*x)/(1-M^2));
C = exp( -1i*((M*k*x)/(1-M^2)) – (1i*omega*t));
differentiated_Green = (A * B) .* C;
The function "differentiated_green" is a complex value due to the presence of Hankel function in "B" and the exponential term "C". Since I want to convolve this function’s real values with the function "f", these are the commands I am using:
p = conv(real(differentiated_Green),f,’same’);
These commands are giving me NaN values and I am trying to understand what’s going wrong. Can someone please point out to me where I should troubleshoot ?I am trying to generate a 1-D discrete convolution data-set but I keep getting NaN values. I am wondering what’s going wrong. I want to convolve the function "differentiated_green" with the function "f" with respect to the variable "x".
These are the common parameters needed for complete definition of both the functions:
M = 0.5; alpha = log(2)/2; epsilon = 0.5; f = 1/30; omega = 2*pi*f; c_inf = 340; k = omega/c_inf; t = 270; nodes = 401;
y = 0;
x_start = -200; x_end = 200;
length = x_end – x_start;
x = linspace(x_start,x_end,nodes);
This is the definition of the function "f":
f = epsilon * exp( -alpha * x.^2);
This is the definition of the function "differentiated_green":
A = omega/( 4 * (c_inf^2)*sqrt(1-M^2));
B = besselh(0, (k*x)/(1-M^2));
C = exp( -1i*((M*k*x)/(1-M^2)) – (1i*omega*t));
differentiated_Green = (A * B) .* C;
The function "differentiated_green" is a complex value due to the presence of Hankel function in "B" and the exponential term "C". Since I want to convolve this function’s real values with the function "f", these are the commands I am using:
p = conv(real(differentiated_Green),f,’same’);
These commands are giving me NaN values and I am trying to understand what’s going wrong. Can someone please point out to me where I should troubleshoot ? I am trying to generate a 1-D discrete convolution data-set but I keep getting NaN values. I am wondering what’s going wrong. I want to convolve the function "differentiated_green" with the function "f" with respect to the variable "x".
These are the common parameters needed for complete definition of both the functions:
M = 0.5; alpha = log(2)/2; epsilon = 0.5; f = 1/30; omega = 2*pi*f; c_inf = 340; k = omega/c_inf; t = 270; nodes = 401;
y = 0;
x_start = -200; x_end = 200;
length = x_end – x_start;
x = linspace(x_start,x_end,nodes);
This is the definition of the function "f":
f = epsilon * exp( -alpha * x.^2);
This is the definition of the function "differentiated_green":
A = omega/( 4 * (c_inf^2)*sqrt(1-M^2));
B = besselh(0, (k*x)/(1-M^2));
C = exp( -1i*((M*k*x)/(1-M^2)) – (1i*omega*t));
differentiated_Green = (A * B) .* C;
The function "differentiated_green" is a complex value due to the presence of Hankel function in "B" and the exponential term "C". Since I want to convolve this function’s real values with the function "f", these are the commands I am using:
p = conv(real(differentiated_Green),f,’same’);
These commands are giving me NaN values and I am trying to understand what’s going wrong. Can someone please point out to me where I should troubleshoot ? convolution MATLAB Answers — New Questions