Can’t get better interpolation at some points
Hi all,
I would be grateful if someone could help with the following matter:
I have a set of complex data called [a2norm_real and a2norm_imag (as per attached)], and another set of complex data was generated as shown in the code. I tried to achieve better interpolation for the Gain, but it fails at certain points (as per attached). No matter how many points I generate, it fails at the same place each time. I have tried different 1D and 2D interpolation methods (including the one below), but this was the best one I could achieve. Thanks!
Here is the code:
data2 = readtable(‘System Gain.xlsx’, ‘VariableNamingRule’, ‘preserve’);
% Process the second file
a2norm_real = data2{:, 5};
a2norm_imag = data2{:, 6};
a2norm_complx = complex(a2norm_real,a2norm_imag);
Gain = complex(data2{:, 1}, data2{:, 2});
a21_mag = linspace(min(abs(a2norm_complx)),max(abs(a2norm_complx)),31).’;
a21_ph = linspace(0,0,31).’;
a21_complx = a21_mag.*exp(1i*pi/180.*a21_ph);
% Perform the interpolation
Interp = griddata(a2norm_real, a2norm_imag, Gain, real(a21_complx), imag(a21_complx), ‘nearest’);
figure;
plot(abs(a2norm_complx), System_Gain, ‘o’, ‘DisplayName’, ‘System gain’);
hold on;
plot(abs(a21_target), System_Gain_Interp, ‘:*’, ‘DisplayName’, ‘System_Gain_Selected’);
legend(‘show’); % Displays the legend with the DisplayName labels
title(‘(Default) Linear Interpolation’);
grid on;
legend(‘Location’, ‘best’);Hi all,
I would be grateful if someone could help with the following matter:
I have a set of complex data called [a2norm_real and a2norm_imag (as per attached)], and another set of complex data was generated as shown in the code. I tried to achieve better interpolation for the Gain, but it fails at certain points (as per attached). No matter how many points I generate, it fails at the same place each time. I have tried different 1D and 2D interpolation methods (including the one below), but this was the best one I could achieve. Thanks!
Here is the code:
data2 = readtable(‘System Gain.xlsx’, ‘VariableNamingRule’, ‘preserve’);
% Process the second file
a2norm_real = data2{:, 5};
a2norm_imag = data2{:, 6};
a2norm_complx = complex(a2norm_real,a2norm_imag);
Gain = complex(data2{:, 1}, data2{:, 2});
a21_mag = linspace(min(abs(a2norm_complx)),max(abs(a2norm_complx)),31).’;
a21_ph = linspace(0,0,31).’;
a21_complx = a21_mag.*exp(1i*pi/180.*a21_ph);
% Perform the interpolation
Interp = griddata(a2norm_real, a2norm_imag, Gain, real(a21_complx), imag(a21_complx), ‘nearest’);
figure;
plot(abs(a2norm_complx), System_Gain, ‘o’, ‘DisplayName’, ‘System gain’);
hold on;
plot(abs(a21_target), System_Gain_Interp, ‘:*’, ‘DisplayName’, ‘System_Gain_Selected’);
legend(‘show’); % Displays the legend with the DisplayName labels
title(‘(Default) Linear Interpolation’);
grid on;
legend(‘Location’, ‘best’); Hi all,
I would be grateful if someone could help with the following matter:
I have a set of complex data called [a2norm_real and a2norm_imag (as per attached)], and another set of complex data was generated as shown in the code. I tried to achieve better interpolation for the Gain, but it fails at certain points (as per attached). No matter how many points I generate, it fails at the same place each time. I have tried different 1D and 2D interpolation methods (including the one below), but this was the best one I could achieve. Thanks!
Here is the code:
data2 = readtable(‘System Gain.xlsx’, ‘VariableNamingRule’, ‘preserve’);
% Process the second file
a2norm_real = data2{:, 5};
a2norm_imag = data2{:, 6};
a2norm_complx = complex(a2norm_real,a2norm_imag);
Gain = complex(data2{:, 1}, data2{:, 2});
a21_mag = linspace(min(abs(a2norm_complx)),max(abs(a2norm_complx)),31).’;
a21_ph = linspace(0,0,31).’;
a21_complx = a21_mag.*exp(1i*pi/180.*a21_ph);
% Perform the interpolation
Interp = griddata(a2norm_real, a2norm_imag, Gain, real(a21_complx), imag(a21_complx), ‘nearest’);
figure;
plot(abs(a2norm_complx), System_Gain, ‘o’, ‘DisplayName’, ‘System gain’);
hold on;
plot(abs(a21_target), System_Gain_Interp, ‘:*’, ‘DisplayName’, ‘System_Gain_Selected’);
legend(‘show’); % Displays the legend with the DisplayName labels
title(‘(Default) Linear Interpolation’);
grid on;
legend(‘Location’, ‘best’); interpolation MATLAB Answers — New Questions