type
status
date
slug
summary
tags
category
icon
password
comment
ChatGPT现在已经支持绘图了,之前我一直以为它出图和Midjourney一样,虽然好看,但是并没有太大的用处。
今天学习一个专业概念的时候,突然想让ChatGPT画一下对应的函数图像,出图效果相当不错。
一年而已,它的功能已经进化到这种程度了,很难想象以后它的发展会有多么迅猛。
下面是使用ChatGPT画的两张函数图,以及相关的对话过程,希望对你有用。
Ricker子波
Ricker子波的数学表达式:
我的提问
Ricker子波的波形图是怎么样的,请为我画出它的函数图像
ChatGPT的回答:
![[1 Personal Project/3 王博霖-NotionNext/attachments/6395c8b680c46995cf209939d76bec30_MD5.png]]
我网上搜了一下,这个图是没有问题的;它还给出了相关的python代码,我也运行了,可以正常出图。
Python代码如下:
import numpy as np import matplotlib.pyplot as plt # Define the Ricker wavelet function def ricker_wavelet(t, sigma): return (1 - 2*(np.pi**2)*(sigma**2)*(t**2)) * np.exp(-(np.pi**2)*(sigma**2)*(t**2)) # Time vector t = np.linspace(-1.5, 1.5, 300) # Generate the Ricker wavelet sigma = 1 # Standard deviation wavelet = ricker_wavelet(t, sigma) # Plot the wavelet plt.figure(figsize=(10, 4)) plt.plot(t, wavelet, label='Ricker Wavelet') plt.title('Ricker Wavelet (σ = 1)') plt.xlabel('Time') plt.ylabel('Amplitude') plt.grid(True) plt.legend() plt.show()
代码运行后得到的图
![[1 Personal Project/3 王博霖-NotionNext/attachments/88f0d85e5fa43db4143d7d97dbbf657e_MD5.png]]
指数正弦衰减信号
我的提问
请作一张指数正弦衰减信号的图,给出相关的参数以及图像对应的函数表达式
ChatGPT的回答
![[1 Personal Project/3 王博霖-NotionNext/attachments/d27211a3858f14e5cde56783ada4b54c_MD5.png]]
Here is the graph of an exponential decaying sine wave. The parameters used for this graph are:
- Amplitude (A):1
- Frequency (f):5Hz
- Decay constant():0.5
The function expression for this signal is:
where,,and .This graph illustrates how the amplitude of the sine wave decreases exponentially over time.
Python代码如下:
import numpy as np import matplotlib.pyplot as plt # Define the exponential decaying sine wave function def exp_decaying_sine_wave(t, A, f, alpha): """ A: Amplitude f: Frequency (Hz) alpha: Decay constant t: Time vector """ return A * np.exp(-alpha * t) * np.sin(2 * np.pi * f * t) # Parameters for the exponential decaying sine wave A = 1 # Amplitude f = 5 # Frequency in Hz alpha = 0.5 # Decay constant # Time vector t = np.linspace(0, 2, 500) # 2 seconds # Generate the signal signal = exp_decaying_sine_wave(t, A, f, alpha) # Plot the signal plt.figure(figsize=(10, 4)) plt.plot(t, signal, label='Exponential Decaying Sine Wave') plt.title('Exponential Decaying Sine Wave') plt.xlabel('Time (s)') plt.ylabel('Amplitude') plt.grid(True) plt.legend() plt.show() # Function expression function_expression = f"A * exp(-alpha * t) * sin(2 * pi * f * t), A={A}, f={f} Hz, alpha={alpha}" function_expression
概括总结
就画了两张图,数据量比较少,但是管中窥豹,虽然仅仅两张图,已经可以看出很多东西了。
这两个函数其实还是有一点点复杂的,但是ChatGPT没有任何压力很轻松的一次性就画出来了。
嗯,太秀了!
按照现在的这种情况,它应该在我们很多方面都能提供很大的帮助。
如果你还没用过,可以用一下,不要用阉割版本,用官网原版才能得到最好的体验。
- 作者:王博霖
- 链接:https://www.wbolyn.com//article/252a91b5-8f66-81a2-ba28-c701d25121e0
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。