Summing result of multiple function calls to verify Nyquist criterium
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!