Summing result of multiple function calls to verify Nyquist criterium
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Sai Sumanth Korthiwada
am 24 Feb. 2022
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 Kommentare
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!