# Commits

fixed bug

• Participants
• Parent commits 493b80e

# File hw4/prob1.py

f : def
A function which given ``x``, computes the weight value
"""
+
def f(x):
if -0.5 < x <= 0.5:
return 1
f : def
A function which given ``x``, computes the weight value
"""
+
def f(x):
x = abs(x)
if x < 1:
f : def
A function which given ``x``, computes the weight value
"""
+
def f(x):
x = abs(x)
x2 = x ** 2
f : def
A function which given ``x``, computes the window value
"""
+
def f(x):
x = abs(x)
if x < param:
f : def
A function which given ``x``, computes the window value
"""
+
def f(x):
x = abs(x)
if x < param:
left, right = -fwidth - fwidth * 0.1, fwidth + fwidth * 0.1
xs = numpy.arange(left, right, (right - left) / 200)
if self.method_base:
-            plt.plot(xs, [self.method(x) * self.fscale for x in xs], linewidth=2)
-            plt.plot(xs, [self.method_base(x) * self.fscale for x in xs])
-            plt.plot(xs, [sinc(x * math.pi) for x in xs])
+            plt.plot(xs / self.fscale, [self.method(x) * self.fscale for x in xs], linewidth=2)
+            plt.plot(xs / self.fscale, [self.method_base(x) * self.fscale for x in xs])
+            plt.plot(xs / self.fscale, [sinc(x * math.pi) for x in xs])
labels = [self.method_name + ' * sinc', self.method_name, 'sinc']
else:
-            plt.plot(xs, [self.method(x) * self.fscale for x in xs])
+            plt.plot(xs / self.fscale, [self.method(x) * self.fscale for x in xs])
labels = [self.method_name]
plt.legend(labels, loc=0)