write a c++ code to solve #1 that can be plotted in GNUPLOT
Write the data (y1, y2) to a file named “LASTNAME_Prob1.dat”Example: If your name is John Doe – file name would be“DOE_Prob1.dat” ▪ Plot the result with lines using GNUPLOT (Hint:see lecture 08) ▪ Submit full code (copy and paste). Plot must beon a separate page. ▪ Run the code again and plot the result for: = 0.1 = 11.0
Numerically solve the following: 3. Solve Problem 1 with Runge Kutta Method: • Plot the results of Runge-Kutta Method and Euler Method on 1. Use Euler’s Method: the same graph. = V Submit the code = -kv – u3 + B cos(t) u(0) = 1.0 v(0) = 1.0 k = 0.4 B= 20.0 h = 0.01 i = 10000 • Write the data (y1, y2) to a file named “LASTNAME_Prob1.dat” Example: If your name is John Doe – file name would be “DOE_Prob1.dat” • Plot the result with lines using GNUPLOT (Hint: see lecture 08) · Submit full code (copy and paste). Plot must be on a separate page. • Run the code again and plot the result for: k = 0.1 B = 11.0 2. Solve the Differential Equation: y’ = -tayy (0) = 1 h = 0.1 0<t <1 Using, Plot these three results in a single graph in GNUPLOT. • Analytical Solution The syntax is: plot “datal.txt” with lines, “data2.txt” with lines, exact • Euler Method • Runge-Kutta Method where “data1.txt” contains output from Euler Method, and, “data2.txt” contains output from Runge-Kutta Method. Show transcribed image text Numerically solve the following: 3. Solve Problem 1 with Runge Kutta Method: • Plot the results of Runge-Kutta Method and Euler Method on 1. Use Euler’s Method: the same graph. = V Submit the code = -kv – u3 + B cos(t) u(0) = 1.0 v(0) = 1.0 k = 0.4 B= 20.0 h = 0.01 i = 10000 • Write the data (y1, y2) to a file named “LASTNAME_Prob1.dat” Example: If your name is John Doe – file name would be “DOE_Prob1.dat” • Plot the result with lines using GNUPLOT (Hint: see lecture 08) · Submit full code (copy and paste). Plot must be on a separate page. • Run the code again and plot the result for: k = 0.1 B = 11.0 2. Solve the Differential Equation: y’ = -tayy (0) = 1 h = 0.1 0
Expert Answer
Answer to write a c++ code to solve #1 that can be plotted in GNUPLOT Write the data (y1, y2) to a file named “LASTNAME_Prob1.da…