Difficulty getting power on an Airplane Radar project

1 次查看(过去 30 天)
I've got an issue with a matlab code I'm writing. I am attempting to plot the variable t, which is time, against the power variable. The issue is that matlab doesn't create an array for time that is matching the array for Gain. It seems to me that this is why the division for power isn't sucessful. Ive included the full code below in. I would appreciate any help that could be given!
clc; clear; close all;
N = 20; % Number of elements
M = 50; % IDK
Bd = pi/4; % Beta*distance between elements
phi = linspace(0,2*pi,300); % also dont exactly know
for i = 1:M
%% Power Pattern
alpha = 8*Bd*i/M; % Might have to change
psi = (Bd * cos(phi)) + (alpha);
F_array = (abs(sin(N*psi/2)./sin(psi/2))).^2; % Power radiation pattern
F_array_max = 400; % N^2
Pn = F_array / F_array_max; % Normalized power radiation pattern; max value 1
subplot(2,2,1)
polarplot(phi,Pn);
rlim([0 1])
%% Airplane Travel
t = 0:1:i; % makes t a function of time
z = (5000 - (t*(100))); % distance to airplane with time
theta = asin(500./z); % angle to airplane with time
subplot(2,2,2)
polarplot(theta,z);
%% Airplane Power Recieved
D = 1.64*( (cos(90*cos(psi))) / (((sin(psi))).^2));
Gain = (D * F_array).^2;
r = sqrt(250000 + z.^2);
Power = Gain / (r.^4);
subplot(2,2,3)
plot(t, Gain,'*')
pause(.5)
end;
Error using /
Matrix dimensions must agree.
  3 个评论
Tino Veitengruber
Tino Veitengruber 2022-7-31
Sure! I can try to elaborate a little more. Its an algorithem for determining the power pattern of a radar antenna in the first section. In the second second, the travel of the airplane itself is plotting using a polar plot. Lastly, the last part should calculate power recieved using the formula that the power = gain/r
r is a continually changing variable as the hypothenus from the antenna to a height at 500 meter. This radius is dependent on the changing angle. The plane is flying at 100m/s in the direction of the antenna. This leads to the adjacent side becoming z = 5000-100*t . Additionally, D is a gain constant for a half wave dipole antenna. This gain changes based on the angle to the aircraft as mentioned above. This gain constant is multiplied times the gain of the array which is F_array. I appreciate the help. I can also elaborate more if its still not clear.
Tino Veitengruber
Tino Veitengruber 2022-7-31
I did forget to mention this... there is a sweep where the alpha term is changing vs. time. This is why the for loop is present.

请先登录,再进行评论。

回答(1 个)

Sai Kiran
Sai Kiran 2022-10-19
Hi,
The error is caused due to mismatch between dimensions of Gain(1x300) and r (1x2) .
Variable r is dependent on t and whereas t =0:1:i which is dependent on iterable variable i . This changes the dimension of t in every iteration.
Try to keep the dimension of t constant and equal to that of Gain. Then the code runs without throwing any error.
Hope it helps!

类别

Help CenterFile Exchange 中查找有关 Radar and EW Systems 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by