how can i solve this?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
I am trying to solve this really simple code problems, but I wan not able:
Omega=zeros(1,800);
Y=cos(km2rad(20));
for n=1:800
Omega(n)=(1/2)*[(legendreP(n-1,Y))-(legendreP(n+1,Y))];
end
Omegazero=(1/2)*(1-Y);
OmegaT=[Omegazero Omega];
********************************************************************
The real formulation is:
Omega(n)=1/2[Pn-1(Y)-Pn+1(Y)],
OmegaZero=1/2(1-Y)
Y=cos(20km) that should be in radian.
I know the answer but I can not reach to real answer. I got something really different.
Thanks
채택된 답변
Walter Roberson
2015년 11월 29일
편집: Walter Roberson
2015년 11월 29일
0 개 추천
I could see how
Bn=2n-1/n+1*Bn-1*cos(psi)-(n-2/n+1)*Bn-2
could translate to
B(n) = (2*n-1)/(n+1) * B(n-1) * cos(psi) - (n-2)/(n+1)*B(n-2);
but where are your "3" coming from in your line
B(n)=((((2*n)-3)/(n))*B(n-1)*cos(psi))-(((n-3)/(n))*B(n-2));
?
댓글 수: 7
Mahdiye
2015년 11월 29일
Thank you Walter, I changed my question, could you please answer this??? Thanks
Walter Roberson
2015년 11월 29일
I have no idea what it means to express km in radians.
LP(1) = legendreP(1,Y);
LP(2) = legendreP(2,Y);
for n = 1:800
LP(n+2) = legendreP(n+2,Y);
Omega(n) =(1/2)*(LP(n)-LP(n+2));
end
You might need to define
legendreP = @(n,x) double( feval(symengine, 'legendreP', n, x) );
Mahdiye
2015년 11월 29일
편집: Walter Roberson
2015년 11월 29일
Thanks Walter, some points:
LP(1) = legendreP(0,Y);
LP(2) = legendreP(1,Y);
LP(n+2) = legendreP(n+1,Y);
??? Am I right???
and:
what about cos(Y)???
When I use just Y=km2rad(20) instead Y=cos(km2rad(20)), it seems near to have wisely results.
It should be stated that, this is a disk on a sphere that has radius 20 km which we need angular radius in radian. So, we use km2rad for converting distance to radians.
And why we need to use:
legendreP = @(n,x) double( feval(symengine, 'legendreP', n, x) );
??
Thanks
Walter Roberson
2015년 11월 29일
Yes you are right that LP(n+2) = legendreP(n+1,Y)
You have defined the size of the sphere (20 km) but you have not defined the angle to be subtended. km2rad(Distance) by default means
fraction = Distance / (2 * pi * radius_of_Earth_in_km)
radians = fraction * (2 * pi)
which works out as
radians = Distance / radius_of_Earth_in_km
If you want to use a sphere with a radius different than the radius of the Earth then you would need to use km2rad with two parameters. km2rad(Distance, radius_in_km). For a sphere of radius 20 km you would use km2rad(Distance, 20) which would come out as
radians = Distance / 20
But notice that you need to define the Distance.
Radians is 2 * Pi * fraction around the circle that you have traveled. And that information about how far around the circle you have traveled is missing at this time: you have only defined how big the circle is.
Thank you Walter; For the Earth, we have 111 km on surface for 1 degree and as my disk is on the Earth with radius 20 km: angular radius: 20/111 in degree and then *pi/180 for radian. Am I right???
And still another question: Why we need to use:
legendreP = @(n,x) double( feval(symengine, 'legendreP', n, x) );
??
Thanks
Walter Roberson
2015년 11월 30일
That calculation looks okay.
legendreP is part of the symbolic toolbox, so it is only invoked if at least one of the arguments to it is symbolic, but you are wanting to invoke it with arguments that are completely numeric. legendreP(numeric,numeric) would not be found -- without a symbolic parameter MATLAB does not have reason to look in the symbolic toolbox for a match.
legendreP = @(n,x) double( feval(symengine, 'legendreP', n, x) );
locally defines legendreP as an anonymous function with two arguments that invokes the symbolic engine (MuPAD) directly and tells the symbolic engine to execute the MuPAD function legendreP with the two given arguments. With this direct call, MATLAB will be able to find the correct function and execute it, returning a symbolic number as a solution; double() then converts the symbolic number to a floating point number that MATLAB can use.
Walter Roberson
2015년 12월 2일
편집: Walter Roberson
2015년 12월 2일
Mahdiye comments "Wonderful answer"
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 3-D Function Plots에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
