controlling array data when calculating

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;

 Akzeptierte Antwort

Image Analyst
Image Analyst am 8 Sep. 2013

0 Stimmen

Another way is to just delete the element where w=0:
w(w==0) = [];

Weitere Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 8 Sep. 2013
Bearbeitet: Azzi Abdelmalek am 8 Sep. 2013

0 Stimmen

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)']

Kategorien

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by