xmax is scalar floating function ?

1 回表示 (過去 30 日間)
Albert Justin
Albert Justin 2022 年 4 月 10 日
回答済み: Jan 2022 年 4 月 10 日
%double Integrals
syms x y
fun=input('Enter the function f(x,y)=');
x1=input('Enter the outer integral lower limit:');
x2=input('Enter the outer integral upper limit:');
y1=input('Enter the inner integral lower limit:');
y2=input('Enter the inner integral upper limit:');
A=integral2(fun,x1,x2,y1,y2);
disp(' Integral value is =')
disp(A)
output
%Enter the function f(x,y)=@(x,y) x.*y
%Enter the outer integral lower limit:0
%Enter the outer integral upper limit:a
%Enter the inner integral lower limit:@(x) x.^2
%Enter the inner integral upper limit:@(x) 2-x
%Error using integral2 (line 80)
%XMAX must be a floating point
%scalar.

回答 (2 件)

dpb
dpb 2022 年 4 月 10 日
...
%Enter the outer integral upper limit:a
...
a isn't defined above; it must be a numeric value; you passed the character 'a'

Jan
Jan 2022 年 4 月 10 日
integral2() expects the limits to be floating point numbers. Then @(x) x.^2 and @(x) 2-x are not matching, because these are function handles.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by