erf
误差函数
语法
说明
示例
求误差函数
求值的误差函数。
erf(0.76)
ans = 0.7175
求向量元素的误差函数。
V = [-0.5 0 1 0.72]; erf(V)
ans = 1×4
-0.5205 0 0.8427 0.6914
求矩阵元素的误差函数。
M = [0.29 -0.11; 3.1 -2.9]; erf(M)
ans = 2×2
0.3183 -0.1236
1.0000 -1.0000
通过初始条件计算热方程的解
其中, 表示位置为 、时间为 时的温度,热方程为
其中, 是一个常量。
对于热系数为 的材料,以及对于其他位置 和 的初始条件 ,热方程的解为
对于 k = 2
、a = 5
和 b = 1
,为热方程在 t = 0.1
、5
和 100
时的解绘图。
x = -4:0.01:6; t = [0.1 5 100]; a = 5; k = 2; b = 1; figure(1) hold on for i = 1:3 u(i,:) = (a/2)*(erf((x-b)/sqrt(4*k*t(i)))); plot(x,u(i,:)) end grid on xlabel('x') ylabel('Temperature') legend('t = 0.1','t = 5','t = 100','Location','best') title('Temperatures across material at t = 0.1, t = 5, and t = 100')
输入参数
x
— 输入
实数 | 由实数组成的向量 | 实数矩阵 | 由实数组成的多维数组
输入,指定为实数或实数的向量、矩阵、多维数组。x
不能是稀疏矩阵。
数据类型: single
| double
详细信息
误差函数
x 的误差函数 erf 是
提示
扩展功能
tall 数组
对行数太多而无法放入内存的数组进行计算。
此函数完全支持 tall 数组。有关详细信息,请参阅 tall 数组。
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
用法说明和限制:
不支持严格的单精度计算。在生成的代码中,单精度输入生成单精度输出。但是,函数内部的变量可能是双精度。
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
GPU 数组
通过使用 Parallel Computing Toolbox™ 在图形处理单元 (GPU) 上运行来加快代码执行。
此函数完全支持 GPU 数组。有关详细信息,请参阅Run MATLAB Functions on a GPU (Parallel Computing Toolbox)。
分布式数组
使用 Parallel Computing Toolbox™ 在集群的组合内存中对大型数组进行分区。
此函数完全支持分布式数组。有关详细信息,请参阅Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox)。
版本历史记录
在 R2006a 之前推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)