Summing result of multiple function calls to verify Nyquist criterium

조회 수: 1 (최근 30일)
Julian Vos
Julian Vos 2021년 1월 4일
답변: Sai Sumanth Korthiwada 2022년 2월 24일
I am writing code to plot a certain signal, P(f) with shifts of 1/T. Now I am interested in a method to add all these separate and limited functions [-1/T 1/T] and plot them in the same fplot window to verify if the result satisfies the Nyquist criterium for zero inter symbol interference .
T = 1;
bounds = [-1/T 1/T];
P = @(f) 1./sqrt(T) .* cos(pi.*f.*T./2);
NO_graphs = 3;
for m = -(NO_graphs-1)/2:1:(NO_graphs-1)/2
bounds = [-1/T+m/T 1/T+m/T];
p_next = FuncShift(p, 1/T*m);
fplot(p_next,bounds);
hold on
end
function [ func_up ] = FuncShift( func, shift ) %not mine but works like a charm
func_up = @(x)(func(x-shift));
end

답변 (1개)

Sai Sumanth Korthiwada
Sai Sumanth Korthiwada 2022년 2월 24일
The given code plots the functions from [-1/T 1/T] in the same window. Changing the case of the variable from “P” to “p” in line 4 will output the desired “fplot” in a single window using “hold on” keyword.
T = 1;
bounds = [-1/T 1/T];
% replacing 'P' with 'p'
p = @(f) 1./sqrt(T) .* cos(pi.*f.*T./2);
NO_graphs = 3;
for m = -(NO_graphs-1)/2:1:(NO_graphs-1)/2
bounds = [-1/T+m/T 1/T+m/T];
p_next = FuncShift(p, 1/T*m);
fplot(p_next,bounds);
hold on
end
function [ func_up ] = FuncShift( func, shift ) %not mine but works like a charm
func_up = @(x)(func(x-shift));
end
Please refer to fplot MathWorks documentation for more information related to Plot expression or function.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by