fir1 returns very different results between two Matlab installations

Viewed 25

When my colleague runs:

>> fir1(8,.5)

on his 2018b installation, he gets

ans =

   -0.0000   -0.0227    0.0000    0.2740    0.4974    0.2740    0.0000   -0.0227   -0.0000

but when I run it on my 2017b installation, I get:

ans =

    0.0093    0.0364    0.1157    0.2113    0.2547    0.2113    0.1157    0.0364    0.0093

We believe his result is correct, because when he runs

   >> clf; plot(abs(freqz(fir1(100, 0.5 ),1, 800) ) ); grid on;

the plot crosses 0.5 at half the Nyquist (400 on the x axis) as expected.

But when I run it, the plot crosses 0.5 at around 130 on the x axis.

I did this to check the path:

>> which fir1
C:\Program Files\MATLAB\R2017b\toolbox\signal\signal\fir1.m

I am running 2017b; he is running 2018b. I did a WinMerge comparison between the two fir1.m files. They were different, but not in any way that might explain this, at least not that I could see.

Before running these tests I renamed three functions that had been shadowing Matlab functions and did

>> clear all

to be certain that those functions were no longer shadowing. They had been: gamma, isvector and xor.

I would be surprised if 2017b had a broken fir1. What could be causing this?

0 Answers
Related