Hi there,
I am trying to create a radar app from scratch using functions that are tested okay in Matlab, when i run the codes in appdesigner, the graph does not show. Kindly help. Thanks.
Codes are :
tsc = app.TscansEditField.Value;
Tsc = 10*log10(tsc); % convert Tsc into log equiv
sigma_a = app.AircraftRCSdBsmEditField.Value;
sigma_m = app.MissileRCSdBsmEditField.Value;
% four_pi = 10*log10(4.0 * pi); % (4pi) in dB
k_db = 10*log10(1.38e-23); % Boltzman's constant in dB equiv.
te = app.EffectiveTemperatureKEditField.Value;
Te = 10*log10(te); % noise temp. in dB
% range_a = app.RangeaKmEditField.Value;
% range_adb = 10*log10(range_a* 1000.); % target range^4 in dB
% range_m = app.RangemKmEditField.Value;
% range_mdb = 10*log10(range_m* 1000.); % target range^4 in dB
az_anglea = app.AzimuthangledegEditField.Value;
el_anglea = app.ElevationangledegEditField.Value;
rloss = app.RadarLossdBEditField.Value;
snr = app.SNRdBEditField.Value;
nf = app.NoiseFiguredBEditField.Value;
factor = 10*log10(4*pi);
% Compute Omega in steradians
omega = (az_anglea / 57.296) * (el_anglea /57.296);
omega_db = 10.0*log10(omega); % Convert Omega to dBs
% Plot Power aperture product for missile and aircraft
rangevar = linspace (2,90,1);
rangedb = 10*log10(rangevar);
papm = snr - sigma_m - Tsc + factor + 4.0 .* rangedb + k_db + Te + nf + rloss + omega_db;
papa = snr - sigma_a - Tsc + factor + 4.0 .* rangedb + k_db + Te + nf + rloss + omega_db;
plot(app.UIAxes4,rangevar,papm,"g")
hold (app.UIAxes4, 'on' )
plot(app.UIAxes4,rangevar,papa, "r")
hold (app.UIAxes4, 'off' )

댓글 수: 2

Walter Roberson
Walter Roberson 2022년 7월 26일
it would help to know values for TscansEditField and the other two
Bumze
Bumze 2022년 7월 26일
편집: Bumze 2022년 7월 27일
Thank you for the response.
These codes off the text works perfectly in Matlab.
I have developed the app to compute the power aperture product values but the graph. Thanks

댓글을 달려면 로그인하십시오.

 채택된 답변

Cris LaPierre
Cris LaPierre 2022년 7월 26일
편집: Cris LaPierre 2022년 7월 26일

0 개 추천

It looks like you tried to replace the for loop with an elementwise multiplication. However, your syntax for rangevar is only returning a single value. Therefore, the resulting calculation is a single value. Because the plot function does not include a marker style by default, when you plat a single point, it is not visible.
With linspace, you need to specify the number of points you want as the 3rd input. If you instead want to define the increment, stick with the colon operator.
rangevar = 2:90;
% or
rangevar = linspace(2,90,89);

댓글 수: 5

Bumze
Bumze 2022년 7월 26일
Thanks . I have corrected the linspace error but still have no graph plotted. I also used the for loop , no graph as well.
Cris LaPierre
Cris LaPierre 2022년 7월 26일
편집: Cris LaPierre 2022년 7월 26일
I mocked up your app using the info you provided. Works for me. Can you confirm that your axes are, in fact, named UIAxes4?
My app does not use a for loop, but did create rangevar using one of the approaches in my answer (same result using either approach).
Bumze
Bumze 2022년 7월 27일
편집: Bumze 2022년 7월 27일
@Cris, your result is what I expected. The axes is indeed UIaxes4, was it only the rangevar that was changed to get your graph or you changed any other line? Thanks so much.
Bumze
Bumze 2022년 7월 27일
Thanks Cris, Mathworks team. I did it all over and got the right results.
Cris LaPierre
Cris LaPierre 2022년 7월 27일
Glad to hear. I did have to build the entire app, but the only thing I changed in the code you shared was rangevar.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 7월 26일

댓글:

2022년 7월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by