MATLAB Learn How to Plot Figures in MATLAB: Step-by-Step Guide and Helpful Tips

AI Thread Summary
The discussion centers around a user seeking assistance with MATLAB plotting. The user is struggling to replicate a specific plot and shares their code, which involves calculations for beta_square and theta. Key points of feedback include the need to convert beta_square to decibels (dB) and theta to degrees for accurate representation. Additionally, it is highlighted that the division in the theta calculation should use element-wise division (./) instead of scalar division (/) to ensure proper vector handling. The user acknowledges the correction regarding the division operator, indicating progress in resolving their issue.
Nate Duong
Messages
125
Reaction score
4
Dear group,

I am new with MATLAB and trying to plot these figure out as the file request.

I tried but could not get the same plot as the file has.

I hope anyone can help. Here is the code which i am working on.

Thank you.
Matlab:
fc = 553e6;
w   = 0:2*pi*fc*1e-2:100*2*pi*fc;
pau = 0.33;
tau = 0.2e-9; % in nano second

% beta_square = zeros(1,length(w));

beta_square = 1 + 2*pau*cos(w*tau) + pau^2;
theta  = atan(-pau*sin(w*tau)/(1+pau*cos(w*tau)));

figure,plot(w,beta_square)
figure,plot(w,theta)
 

Attachments

Last edited by a moderator:
Physics news on Phys.org
your beta_square is not in dB and the angle is not in degrees you will have to convert.

also
Code:
 theta  = atan(-pau*sin(w*tau)./(1+pau*cos(w*tau)));
you need a ./ not just / for the division because w is a vector not a scalar.
 
Dr Transport said:
your beta_square is not in dB and the angle is not in degrees you will have to convert.

also
Code:
 theta  = atan(-pau*sin(w*tau)./(1+pau*cos(w*tau)));
you need a ./ not just / for the division because w is a vector not a scalar.
@Dr Transport: oh yeah, I missed that dot, that's why I received only scalar not a vector.
Thank you, for the help.
 
Back
Top