classdef Electricalsignal < Signal %ELECTRICALSIGNAL Summary of this class goes here % Detailed explanation goes here properties fs end methods function obj = Electricalsignal(signal, options) %ELECTRICALSIGNAL Construct an instance of this class % Detailed explanation goes here arguments signal options.fs options.logbook end obj = obj@Signal(signal); fn = fieldnames(options); for l = 1:numel(fn) obj.(fn{l}) = options.(fn{l}); end end function pow = power(obj) pow = mean( abs(obj.signal).^2 ) ; pow = pow2db(pow)+30; %dbm end function cspr = cspr(obj) carrier_power_dbm = pow2db( abs(mean(obj.signal)).^2 )+30; % dB -> +30 -> dBm signal_power_dbm = obj.power; carr_lin = abs(mean(obj.signal)).^2; sign_lin = mean(abs(obj.signal).^2); cspr_lin = pow2db(carr_lin/sign_lin); cspr =carrier_power_dbm-signal_power_dbm; end end end