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

1 vue (au cours des 30 derniers jours)
GRANT
GRANT le 7 Sep 2023
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 commentaires
GRANT
GRANT le 7 Sep 2023
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
GRANT
GRANT le 7 Sep 2023
Added some extra to it for testing purposes. Trying to debug this right now.

Connectez-vous pour commenter.

Réponses (1)

Pooja Kumari
Pooja Kumari le 7 Sep 2023
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!

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by