필터 지우기
필터 지우기

Trying to use quad to solve this integral but keep getting error

조회 수: 1 (최근 30일)
Maryam Ansari
Maryam Ansari 2016년 4월 7일
댓글: Steven Lord 2016년 4월 7일
y = @(x)((1.941-24.3*x).^2)/(2.92*(0.02408-x)*(0.01605-x));
%Using quad to calculate integral
time = quad(y,0,0.01204);
display(time);
This is the error I get
Error in HW7Q2>@(x)((1.941-24.3*x).^2)./(2.92*(0.02408-x)*(0.01605-x))
Error in quad (line 67)
y = f(x, varargin{:});
Error in HW7Q2 (line 4)
time = quad(y,0,0.01204);

답변 (1개)

Roger Stafford
Roger Stafford 2016년 4월 7일
You've forgotten the dot in your division. It should be:
y = @(x)((1.941-24.3*x).^2)./(2.92*(0.02408-x)*(0.01605-x));
  댓글 수: 2
Maryam Ansari
Maryam Ansari 2016년 4월 7일
I tried putting the dot but I'm still getting the same error
Steven Lord
Steven Lord 2016년 4월 7일
Add a dot before the last * as well.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by