#Plotting a Complex Function in GNUplot set terminal png size 400, 300 set output 'complex_function.png' # Set the title and labels set title "Complex Function: f(x) = e^(ix)" set xlabel "X-axis" set ylabel "Y-axis" set grid # Define a complex function f(x) = e^(ix) f_real(x) = cos(x) # Real part: cos(x) f_imag(x) = sin(x) # Imaginary part: sin(x) f_magnitude(x) = sqrt(f_real(x)**2 + f_imag(x)**2) # Magnitude: |e^(ix)| f_phase(x) = atan2(f_imag(x), f_real(x)) # Phase: arg(e^(ix)) # Plot the real part, imaginary part, magnitude, and phase of the complex function plot f_real(x) with lines lw 2 title 'Re:cos(x)', \ f_imag(x) with lines lw 2 title 'Im:sin(x)', \ f_magnitude(x) with lines lw 2 title 'Magnitude', \ f_phase(x) with lines lw 2 title 'Phase'