请输入您要查询的百科知识:

 

词条 streamslice
释义

函数简介

函数功能:MATLAB函数streamslice用于在片层上绘制流线图。

语法格式:

streamslice(X,Y,Z,U,V,W,startx,starty,startz)

以适中的间距绘制一族带箭头的流线图。这几个参数的含义详见streamline函数。

streamslice(U,V,W,startx,starty,startz)

这种调用格式使用缺省的X、Y、Z参数:

[m,n,p] = size(U);

[X<Y,Z] = meshgrid(1:m,1:n,1:p);

其中meshgrid函数用于生成网格数据。

streamslice(X,Y,U,V)

在2-D坐标中绘制流线图。

streamslice(U,V)

使用缺省的X、Y参数。

streamslice(...,density)

streamslice(...,'arrowsmode')

streamslice(...,'method')

streamslice(axes_handle,...)

h = streamslice(...)

[vertices arrowvertices] = streamslice(...)

相关函数:streamline,meshgrid

程序示例

close all; clear; clc;

k = 8.9875e+9;

% 一个电子带电量绝对值:

e = 1.602e-19;

e_r = 2.8e-15; % 电子的半径

ke = k .* e; % k by e

% 指定区间: d=<x,y<=d,并生成网格数据

d = -2:0.05:2;

[x, y] = meshgrid(d);

% 计算电位

V = ke ./ sqrt(x.^2 + y.^2 + 0.01); % 加了一个0.01,防止分母为0。

% 求电势的梯度,即电场强度

[E_x, E_y] = gradient(-V);

% 绘制电场线分布

t = 0:2*pi/20:2*pi;

sx = e_r * sin(t);

sy = e_r * cos(t);

hold on;

streamslice(x, y, E_x, E_y);

contour(x, y, V, linspace(min(V(:)), max(V(:)), 40));

hold off;

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/30 15:44:27