DSPRelated.com
Forums

Simulation time in Simulink

Started by Ahmed Shahein June 4, 2007
Hallo Everybody,

Well obviously I have more than one question; I will do my
best to be able to illustrate them clearly.


---------------------------------
I am working in the design of multi-bit decimator for low
pass sigma delta modulator, using Simulink I observed something during
simulation. When I specify the simulation time to (sampletime*2^16) I dont get
the expected output while when I increase the simulation time to (sampletime*2^22)
I got the expected output, but it exhausted a lot of time more than 25 minuets
for each single run. I am using discrete fixed step = sampletime and single
tasking mode. I am performing down sampling inside the decimator by 64, i.e.
for each input 64 samples I will get 1 sample at the output. It seems to be
logical because I will get more samples for plotting, but what I am wondering
that the results are completely different.
-----------------------------------
What is the difference between the following codes?

for i = 1 :
length(deci_in),

filter_data_1=filter(b1,[1],deci_in(i));

data_2=downsample(filter_data_1,8);


filter_data_2=filter(b2,[1],data_2);

data_3=downsample(filter_data_2,4);


filter_data_3=filter(b3,[1],data_3);

deci_out(i)=downsample(filter_data_3,2);
end

filter_data_1=filter(b1,[1],deci_in);
data_2=downsample(filter_data_1,8);

filter_data_2=filter(b2,[1],data_2);
data_3=downsample(filter_data_2,4);

filter_data_3=filter(b3,[1],data_3);
deci_out=downsample(filter_data_3,2);

After plotting the results from the 2 codes, the difference
was;
The first code has the same length as the input, which is
not expected because there is a down sampling by 64. But on the other hand it
gives the expected psd plot but shifted in both directions x and y by negative
value.
The second code gives the expected length but not the
expected psd at all.
----------------------------------
I tried both Simulink model and Matlab file and I got the
same unexpected output from both.
----------------------------------
One last question, what is the advantage of specifying or constraining
the simulation step and simulation time?

I am totally confused, I wonder if some one could help me,
please.

Best regards.

Yours,

Ahmed.