diff --git a/Python files/PlotData.py b/Python files/PlotData.py index 4b1ce3039c0e3a48407b6061ef1faad6a9862c09..992f1aee4e8cca095aea46dd6e6f37e53068181b 100644 --- a/Python files/PlotData.py +++ b/Python files/PlotData.py @@ -1,9 +1,9 @@ import matplotlib.pyplot as plt import numpy as np -filename0 = '../Text files/3cos(3x).txt' -filename1 = '../Text files/3cosDFT.txt' -filename2 = '../Text files/3cosFFT.txt' +filename0 = 'Text files/3cos(3x).txt' +filename1 = 'Text files/3cosDFT.txt' +filename2 = 'Text files/3cosFFT.txt' name0 = "3cos(3x)" name1 = "Invers DFT" diff --git a/Python files/chLines.png b/Python files/chLines.png new file mode 100644 index 0000000000000000000000000000000000000000..424f7e6c183adb969c5499494ed4ada2d0a2acf1 Binary files /dev/null and b/Python files/chLines.png differ diff --git a/Python files/examplePlot.py b/Python files/examplePlot.py index 6f67f15525c3a22458ba7132c6e24995d8ff9389..bf41c85c093968e812b29cc4261fc42aa7a3d7f1 100644 --- a/Python files/examplePlot.py +++ b/Python files/examplePlot.py @@ -17,6 +17,12 @@ Y2 = [] X3 = [] Y3 = [] +X4 = [] +X5 = [] +X6 = [] +X7 = [] +X8 = [] + # n = 1001 # for i in range(0,n): # i=i/100 @@ -44,28 +50,71 @@ Y3 = [] # Y3.append(u3) # i=100*i +# ---------------------------------------------------------- +# name0 = "f(x)" +# name1 = "f(x-3)" +# n = 128 +# for i in range(0,n+1): +# X.append((i-n/2)/16) +# Y.append(math.exp(-math.pow((i-n/2)/16,2))) +# X1.append((i-n/2+16)/16) +# Y1.append(math.exp(-math.pow((i-n/2+16)/16-3,2))) -name0 = "f(x)" -name1 = "f(x-3)" -n = 128 -for i in range(0,n+1): - X.append((i-n/2)/16) - Y.append(math.exp(-math.pow((i-n/2)/16,2))) - X1.append((i-n/2+16)/16) - Y1.append(math.exp(-math.pow((i-n/2+16)/16-3,2))) +# plt.plot(X, Y, label = name0) +# plt.plot(X1, Y1, linestyle='--',label = name1) +# ---------------------------------------------------------- +n = 20 +c = 0.25 +for i in range(0,n+1): + X.append(i*c) + X7.append(i*c-1) + X1.append(i*c+1) + X2.append(i*c+2) + X3.append(i*c+3) + X4.append(i*c+4) + X5.append(i*c+5) + X6.append(i*c+6) + X8.append(i*c+7) + Y.append(i) +plt.plot(X, Y, linestyle='--', color='k') +plt.plot(X1, Y, linestyle='--', color='k') +plt.plot(X2, Y, linestyle='--', color='k') +plt.plot(X3, Y, linestyle='--', color='k') +plt.plot(X4, Y, linestyle='--', color='k') +plt.plot(X5, Y, linestyle='--', color='k') +plt.plot(X6, Y, linestyle='--', color='k') +plt.plot(X7, Y, linestyle='--', color='k') +plt.plot(X8, Y, linestyle='--', color='k') # plt.scatter(X, Y) -plt.plot(X, Y, label = name0) -plt.plot(X1, Y1, linestyle='--',label = name1) + # plt.plot(X2, Y2, linestyle='-.',label = name2) # plt.plot(X3, Y3, linestyle=':',label = name3) +# ---------------------------------------------------------- +# angle = np.linspace( 0 , 2 * np.pi , 150 ) + +# radius = 1 + +# x = radius * np.cos( angle ) -1 +# y = radius * np.sin( angle )/2 + +# x2 = (math.sqrt(7-8*radius * x) -1)/2 +# y2 = math.sqrt(7-8*radius * y)/2 + + + +# figure, axes = plt.subplots( 1 ) +# plt.axhline(0, color='k') +# plt.axvline(0, color='k') +# axes.plot( x, y ,linestyle='--') +# axes.plot( x2, y2 ,linestyle='--') -plt.legend() -plt.xlabel('X') -plt.ylabel('u(x,t)') +# plt.legend() +plt.xlabel('x') +plt.ylabel('y') plt.show() print('Plot is done') \ No newline at end of file diff --git a/a.out b/a.out index e6be9554fc8b231617111bfd2e5a8fccdb5c99b8..e468a34cbe14c1b690965133985725ac9ad81d5c 100755 Binary files a/a.out and b/a.out differ diff --git a/algTimer.cc b/algTimer.cc index 8c8fe491fc98bc51638fdc32f2abfbbc6b3db6b2..04364cfeece5beb9278fa177a499924ac4d520c2 100644 --- a/algTimer.cc +++ b/algTimer.cc @@ -28,6 +28,7 @@ int main() // std::vector<std::string> outFiles2 = {"Text files/3cosDFT.txt","Text files/3cosFFT.txt"}; // algTimerCall.algTest(32, "Text files/3cos(3x).txt",outFiles2); + // std::system("python Python\\ files/PlotData.py"); }