How to plot a function of multiple variables, where only 1 variable is unknown

1 次查看(过去 30 天)
Hello,
I am trying to look into hilbert transforms for my class. I am fairly new to matlab so I am experiencing some trouble trying to plot these functions.
Below is some code for a raisedCosine sqrt funciton (IIR) and I am trying to plot this as a function of t with specified values of tau, T_b, and alpha. When I run this code I get the picture below, which is essentially nothing. Am I coding this correctly? I was not able to find alot of support on this exact question.
  3 个评论
GRANT
GRANT 2023-9-7
syms t
fplot(raisedCosineSqrt(t, 0.3e-6, 1e-6, 0.25), [-100 100])
ylim([-10 10])
syms test
test = raisedCosineSqrt(t, 0.3e-6, 1e-6, 0.25)
syms f omega convolution
f = raisedCosineSqrt(t, 0.3e-6, 1e-6, 0.25) * raisedCosineSqrt(t-omega, 0.3e-6, 1e-6, 0.25);
f
convolution = int(f, -inf, inf);
function rc_sq_t = raisedCosineSqrt(t, tau, T_b, alpha)
rc_sq_t = (1/sqrt(T_b))*((sin((1-alpha)*(pi*t/T_b))+(4*alpha*t/T_b)*(cos((1+alpha)*pi*t/T_b)))/((pi*t/T_b)*(1-(4*alpha*t/T_b)^2)));
end

请先登录,再进行评论。

回答(1 个)

Pooja Kumari
Pooja Kumari 2023-9-7
Dear GRANT,
I understand that you are facing issues when plotting the raisedCosine square root function (IIR) as a function of 't', using specified values of 'tau', 'T_b', and 'alpha'. Instead of creating a separate function to obtain the output of the raisedCosine square root function, you can directly store the output in a variable called 'rc_sq_t'. I have provided a sample code below for reference:
% Define the symbolic variable
syms t
tau =0.3e-6;
T_b = 1e-6;
alpha = 0.25;
% Define the function
rc_sq_t = (1/sqrt(T_b))*((sin((1-alpha)*(pi*t/T_b))+(4*alpha*t/T_b)*(cos((1+alpha)*pi*t/T_b)))/((pi*t/T_b)*(1-(4*alpha*t/T_b)^2)));
% Plot the function
fplot(rc_sq_t,[-100,100])
You can refer to the below documentation for more information on "fplot" function:
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by