Azzera filtri
Azzera filtri

controlling array data when calculating

2 visualizzazioni (ultimi 30 giorni)
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;

Risposta accettata

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

Più risposte (2)

Azzi Abdelmalek
Azzi Abdelmalek il 8 Set 2013
Modificato: Azzi Abdelmalek il 8 Set 2013
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 il 8 Set 2013
w = -a:(a/1000.5):a;

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by