controlling array data when calculating

1 次查看(过去 30 天)
im try to avoiding having a w = 0. how do i code this?
a = 10;
w = -a:(a/1000):a
F = 2*sin(a*w)./w;

采纳的回答

Image Analyst
Image Analyst 2013-9-8
Another way is to just delete the element where w=0:
w(w==0) = [];

更多回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-9-8
编辑:Azzi Abdelmalek 2013-9-8
a = 10;
w = -a:a/1000:a;
F = 2*sin(a*w)./w;
tol=0.01
idx=find(abs(F)<tol)
[w(idx)' F(idx)']

Roger Stafford
Roger Stafford 2013-9-8
w = -a:(a/1000.5):a;

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by