필터 지우기
필터 지우기

getting error as integralParseArgs

조회 수: 5 (최근 30일)
nikhil
nikhil 2020년 5월 16일
댓글: nikhil 2020년 5월 16일
Hi all,
i am trying to solve the above equation in matlab, but when i am trying to substitute the alp values and x1 values in code and i am getting an error as matrix dimensions must agree while solving the code
any suggestions and thanks in advance
clc;
clear;
format short
ro= 17.5; R = 65; %polar boss opening radius and radius of cylinder
wa= asind(ro/R); b= 1.225*ro; % winding angle
x = b:5:R;
y = ro:0.45:b;
x1 = x/R;
y1 = y/R;
alp = asind(ro./x); alp1 = asind(ro./y);
i = zeros(size(alp));
j= zeros(size(x1));
for c = 1:numel(alp,x1)
func1= @(x)((cosd(wa).*(x.^3))./((sqrt(1-(x.^3))).*((cosd(wa)*cosd(wa)).*((x.^2).*(1+(x.^2)))-(sind(alp).*sind(alp)))));
i(c) = integral(func1,1,alp(c),x1(c));
end

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 16일
Which variable represent ρ is not clear. Also, the syntax for calling integral is incorrect. Try this code
clc;
clear;
format short
ro= 17.5; R = 65; %polar boss opening radius and radius of cylinder
wa= asind(ro/R); b= 1.225*ro; % winding angle
x = b:5:R;
y = ro:0.45:b;
x1 = x/R;
y1 = y/R;
alp = asind(ro./x); alp1 = asind(ro./y);
i = zeros(size(alp));
j= zeros(size(x1));
for c = 1:numel(alp)
func1= @(x)((cosd(wa).*(x.^3))./((sqrt(1-(x.^3))).*((cosd(wa)*cosd(wa)).*((x.^2).*(1+(x.^2)))-(sind(alp(c)).*sind(alp(c))))));
i(c) = integral(func1,1,x(c));
end
  댓글 수: 5
Ameer Hamza
Ameer Hamza 2020년 5월 16일
There seems to be some problem with the limits of integration or the function itself. If you plot the denominator in the limit of integration, you get the following curve
figure
den = @(y) ((sqrt(1-(y.^3))).*((cosd(wa).*cosd(wa)).*((y.^2).*(1+(y.^2)))-(sind(alp1(d)).*sind(alp1(d)))));
a1 = linspace(y(1)/65, 1, 1000);
a2 = den(a1);
plot(a1, a2);
As you can see, the curve passes through y=0, which means that it has a singularity at that point, which might make the integral diverge. You need to figure out how to avoid this singularity.
nikhil
nikhil 2020년 5월 16일
Thanks sir for your suggestion and time

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by