function mStatesPert = sodaPerturbModel(sodaPar,mStatesPrior,stochForce,mStatesPert,iIter)
% Add model error to the simulated states
% modelErrCov = sodaPar.modelErrCov;
% 
% nStates = sodaPar.nStates;
% nMembers = sodaPar.nEnsembleMembers;
% 
% randNormDraw = randn(1,nStates,nMembers);
% 
% if sodaPar.realPartOnly
%     jumpDist = repmat(real(sqrtm(modelErrCov)),[1,1,nMembers]);
% else
%     jumpDist = repmat(sqrtm(modelErrCov),[1,1,nMembers]);
% end
%         
% 
% for iMember = 1:nMembers
%     mStatesPriorPert(iIter,:,iMember) =...
%     mStatesPrior(iIter,1:nStates,iMember) +...
%         (jumpDist(:,:,iMember)*randNormDraw(1,:,iMember)')';
% end          

nStatesKF = sodaPar.nStatesKF;
nMembers = sodaPar.nEnsembleMembers;


mStatesPert(iIter+1,1:nStatesKF,1:nMembers)=...
    mStatesPrior(iIter+1,1:nStatesKF,1:nMembers)+...
    stochForce(iIter+1,1:nStatesKF,1:nMembers);