plotting a multiple output function
Afficher commentaires plus anciens
Hello!
I am quite new at Matlab
I have tried to plot a multiple output function but all i got is the first out put.
this is the code :
function [h, H] = myrct (t,f,beta)
% In optical communication systems, different linear pulse-shaping filters
% are used to generate continuous-time transmit signals. We can define
% these filters either through their impulse response hp(t) or their
% frequency response Hp( f )=F{hp(t)}, where F{ } stands for the Fourier
% transform.
% rct: Raised-cosine time domain (RCT-Filter)
% Time Domain
h = (1 + cos((pi./beta).*(abs(t)-(1-beta)/2)))/2;
h(abs(t)>(1+beta)/2) = 0;
h(abs(t)<(1-beta)/2) = 1;
h(abs(t)==1/2) = 1/2;
% Frequency Domain
% H = fftshift(fft(h),1);
H = sinc(f).*cos(pi.*beta.*f)./(1-(2*beta.*f).^2);
H(f == -0.5/beta) = sinc(1/(2*beta))*pi/4 ;
H(f == +0.5/beta) = sinc(1/(2*beta))*pi/4;
end
I tried to use :
figure
plot(myrct(t,f,beta))
hold on
It doesn't work and it plots only the first output 'h'.
i tried also
figure
plot(H)
hold on
but I got a msg of Unrecognized function or variable 'h'.
Here are the constants:
l=randi(50,1)
N=randi(50,1)
t=(-l*N/2:l*N/2-1)'/N;
f=(-l*N/2:l*N/2-1)'/l;
beta=rand(1)
please help me with this
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Digital Filter Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!