From: Gregor on
Hey,

I do not understand the following behaviour:
- Simulink Model: In -> Out [1]
In imports the data from the workspace structure 'simin', and exports the data into the vector yout as you can see in [2]

- In the workspace the structure simin is build as follows:
Fs = 4e6;
simin.signals.values = read_complex_binary('../stuff/mitschnitt_802.15.4_2.48G_4MS');
simin.signals.values = simin.signals.values(1.24e6:1.245e6);
simin.signals.dimensions = 1;
simin.time = 0:1/Fs:(length(simin.signals.values)-1)/Fs;

read_complex_binary does what its name is... there is no issue.

- The solver is fixed-stepped and discrete, the stop time depends from the simin's length, and the fixed-step-size is 1/Fs: [3]

- Running the simulator and the vector yout is filled.

Now I would expect yout and simin.signals.values to be the same.

But: plot(abs(yout-simin.signals.values)) gives me the plot you can see in [4].
The reason is that several values are listed twice in yout!
>> [simin.signals.values(2499:2505) yout(2499:2505)]

ans =

1.0e-03 *

0.3357 + 0.1831i 0.3357 + 0.1831i
-0.7324 + 0.5798i -0.7324 + 0.5798i
-0.6104 - 0.4578i -0.6104 - 0.4578i
0.7324 - 0.1526i -0.6104 - 0.4578i
0.3052 - 0.1831i 0.7324 - 0.1526i
-0.7629 - 0.4883i -0.7629 - 0.4883i
-0.0305 - 0.5798i -0.7629 - 0.4883i

First I don't understand _why_ some values from simin.signals.values are not sampled: The solver samples with 1/Fs and the simin's time-vector has a resolution of 1/Fs, too!

Second, I don't understand why this false-sampling occurs only halfway through. I used the following loop to get the doubled values (there are none same values sequenced in simin):
pos = [];
for i = 1:length(yout)-1
if yout(i) == yout(i+1)
pos = [pos i];
end;
end;
plot(pos,ones(length(pos)),'.');
You can see the plot in [5].

I'm pleased to get any clearance.

Thanks,
Gregor

[1] http://imagebin.ca/view/rVq5fX48.html
[2] http://imagebin.ca/view/HdogVB.html
[3] http://imagebin.ca/view/3bDPw3F.html
[4] http://imagebin.ca/view/bMrmNdXY.html
[5] http://imagebin.ca/view/MNLf5sE.html
From: Gregor on
I forgot to mention: this behaviour doesn't depend on length(simin.signal.values). If it's only 100, then the values sampled twice occur from yout(50) to yout(end).