How to generate odd frequency sinusoid input using idinput

조회 수: 5 (최근 30일)
soeren graabaek
soeren graabaek 2023년 7월 3일
댓글: soeren graabaek 2023년 7월 11일
Hi,
I am trying to generate a multisinusoid input signal with odd frequencies for non-linear system identification, as recommended in [1]. Going though the documentation of the System Identification Toolbox, i found the idinput function which allow you to generate a multisinusoid signal. According to the doccumentation [2], the function is designed to also generate even/odd frquences using the parameter "GridSkip", but I cannot figure out how to use the parameter. Can someone help me with some understanding of how this parameter works?
[1]: "Nonlinear system identification: a user-oriented road map" Johan Schoukens and Lennart Ljung, IEEE control system magazine 2019
[2]:

답변 (1개)

Mathieu NOE
Mathieu NOE 2023년 7월 10일
I don't have anything against idinput , but why can't you do this directly with some basic code :
f = (1:2:7); % odd frequencies (array)
ampl = ones(size(f))./f; % amplitude (here decreasing in 1/f law)
dt = 1e-3;
samples = 5e3;
t = (0:samples-1)'*dt;
y = [];
for ci = 1:numel(f)
y = [y ampl(ci)*sin(2*pi*f(ci)*t)];
end
% signal sum of all frequencies and normalisation to +/- 1 amplitude
y = sum(y,2);
y = y./max(abs(y));
plot(t,y)
  댓글 수: 3
Mathieu NOE
Mathieu NOE 2023년 7월 10일
fyi , some methods that can help you reduce the crest factor of the signal
clc
clearvars
f = (1:2:7); % odd frequencies (array)
ampl = ones(size(f))./f; % amplitude (here decreasing in 1/f law)
dt = 1e-3;
samples = 5e3;
t = (0:samples-1)'*dt;
% %multitone signals with low crest factor and as suggested in the Boyd's paper : quadratic phase distribution:
% % phas=pi*(f-1).^2/(numel(f)); % the original version
% phas=pi*(f-1).^2/(numel(f))^2; % I prefer this one
% % or Shapiro Rudin method
phas = shapiro(numel(f));
y = [];
for ci = 1:numel(f)
y = [y ampl(ci)*sin(2*pi*f(ci)*t+phas(ci))];
end
% signal sum of all frequencies and normalisation to +/- 1 amplitude
y = sum(y,2);
y = y./max(abs(y));
plot(t,y)
y_rms = sqrt(mean(y.^2));
CF = max(abs(y))/y_rms % compute crest factor of y
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myphase = shapiro(n) %#ok<*DEFNU>
% phase according to Shapiro Rudin method (minimize crest factor)
if n == 1
myphase = 0;
else
% initialisation
str = [1 1];
k = ceil(log(n)/log(2));
for ci = 1:k-1
l =length(str);
str2 = str;
str2(l/2+1:l) = -str(l/2+1:l);
str = [str str2];
end
mystr = str(1:n);
myphase= zeros(1,n);
ind = mystr==-1;
myphase(ind) = pi;
end
end
soeren graabaek
soeren graabaek 2023년 7월 11일
Thank you, I will try them out :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Preprocess Data에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by