Code for Deliverable 05

This commit is contained in:
Silas Oettinghaus
2024-09-02 09:00:41 +02:00
parent 17a1dfbbd5
commit bb228ae2bd
20 changed files with 1094 additions and 73 deletions

View File

@@ -264,8 +264,7 @@ classdef Signal
% spectrum_plot(obj.signal,options.fsamp,options.figurename,options.displayname);
N = 2^(nextpow2(length(obj.signal))-6);
N = 2^(nextpow2(length(obj.signal))-8);
[p_lin,w] = pwelch(obj.signal,hanning(N),N/2,N,obj.fs,"centered","power","mean");
p_dbm = 10*log10(p_lin)+30; %dB to dBm in case of "power"
@@ -278,7 +277,7 @@ classdef Signal
ylabel("Power (dBm)");
xlim([-obj.fs/2 obj.fs/2].*1e-9)
edgetick = 2^(nextpow2(obj.fs*1e-9));
xticks([-edgetick:16:edgetick]);
% xticks([-edgetick:16:edgetick]);
xlim([-244, 244])
ylim([-120,-0]);
yticks([-200:10:10]);
@@ -329,7 +328,7 @@ classdef Signal
case power_notation.mW
pow_pk = pow_pk .* 1e3; %mW
case power_notation.W
%pow = pow % Watt
pow_pk = pow_pk; % Watt
end
end
@@ -562,6 +561,9 @@ classdef Signal
maxA = max(sig(100:end-100));
minA = min(sig(100:end-100));
% maxA = 0.0015;
% minA = 0;
difference= maxA-minA;
@@ -603,6 +605,7 @@ classdef Signal
min_ = min(obj.signal(100:end-100));
max_ = abs(max(obj.signal(100:end-100)));
end
xlabel('Time in ps')
% add information
@@ -704,8 +707,12 @@ classdef Signal
yticks(linspace(0,histpoints,16));
y_tickstring = sprintfc('%.2f', y_tickstring);
yticklabels(y_tickstring);
xticks(linspace(0,histpoints_horizontal,8))
x_tickstring = sprintfc('%.2f', linspace(0, 2/fsym, 8) .* 1e12);
xticklabels(x_tickstring);
end