필터 지우기
필터 지우기

controlling array data when calculating

조회 수: 2 (최근 30일)
harley
harley 2013년 9월 8일
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에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by