필터 지우기
필터 지우기

Difficulty getting power on an Airplane Radar project

조회 수: 1 (최근 30일)
Tino Veitengruber
Tino Veitengruber 2022년 7월 29일
답변: Sai Kiran 2022년 10월 19일
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에서 Antennas, Microphones, and Sonar Transducers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by