MATLAB: Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

error zeros indices

I get the error 'Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.' when I run this function.
The error occurs on line 41. SigS(j,h,:) = sg1+noise(101:end)+zeros(N);
function [SigS,Sig,F_out,noise] = sig_gen(object,inputs)
t = inputs.t;
f1 = inputs.f1;
f2 = inputs.f2;
a = inputs.a;
a2 = inputs.a2;
Ta = inputs.Ta;
f_sub = inputs.f_sub;
f_trans = inputs.f_trans;
An = inputs.An;
phi = inputs.phi;
A = inputs.A;
N = length(t);
dt = t(2)-t(1);
for j=1:size(object,1)
for h=1:size(object,2)
f = zeros(1,N);
f(1:object(j,h)) = f1;
f(1+object(j,h):end)=f2;
sg1 = 0.25*A.*cos((2*pi*f.*t) + phi).*exp(-a*t); % signal formula
trans = A.*sin((2*pi*f_trans.*t) + phi).*exp(-a2*t); % transducer signal
thermal = 10.*exp(-Ta*t); % thermal signal
sub = 0.25*A.*cos((2*pi*f_sub.*t) + phi).*exp(-a*t); % substrate signal
sg = sg1 + trans + thermal + sub;
sg2 = [zeros(1,100) sg]; % zeros signal
noise = An.*randn(size(sg2)); % noise signal
sg3 = sg2 + noise; % final signal
t2 = ((0:length(sg3)-1)-100)*dt;
% Signal Plotting
Sig(j,h,:)=sg3;
SigS(j,h,:) = sg1+noise(101:end)+zeros(N);
F_out(j,h,:)=f;
end
end
end

Best Answer

We need to know what type of variables the inputs are, give us an example please
By the way, zeros(N) is an NxN matrix and you need in this line a column array; Probably it is the error
SigS(j,h,:) = sg1+noise(101:end)+zeros(1,N);