polyfit vs csapi revolve - can't square the integral on csapi
이전 댓글 표시
Hi all,
I'm trying to compare the volumes of two revolves around the x axis, defined by the same set of (x,y) coordinates. One is a polyfit approximation, which works very well. I'm now trying to do the same with a csapi spline that goes through the actual points, but can't seem to get the integral right. The polyfit works very well;
p=polyfit(x,y,10);
Vp=pi*(polyint(conv(p,p)));
But I can't get the csapi version to work at all;
c=csapi(x,y);
Vs=pi*diff(fnval(fnint(c)^2,[0 143]));
It just spits out errors all the time. Area integrals for both work just fine;
Ap=polyint(p);
As=fnint(c);
The error I get is
> In polyfit (line 84)
In Vase (line 8)
Operator '.^' is not supported for operands of type 'struct'.
Error in ^ (line 22)
Z = X.^Y;
Error in Vase (line 15)
Vs=pi*diff(fnval(fnint(c)^2,[0 143])); %Volume of Spline revolve
What am I doing wrong? How do I solve this?
Best of thanks inadvance,
Kai.
답변 (1개)
Take a look here on how to to generate a spline function squared and integrate it:
카테고리
도움말 센터 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!