Qfunction with unreal argument
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
hi,
i want to calculate the qfunction value qfunc(x) where x is not a real value instead it is a function of x.
can this be calculated in MATLAB?
for eg
sym x
f=(40*log10(x/7))/4
qfunc(f);
i am getting an error saying "The argument of the Q function must be a real array."
Regards,
Karki
채택된 답변
Walter Roberson
2013년 3월 7일
According to the documentation,
Q(x) = 1/2 * erfc(x / sqrt(2))
So for symbolic use I would say
Qfunc = @(x) erfc(x / sqrt(sym(2))) / 2;
then
Qfunc(f)
댓글 수: 13
Suwas Karki
2013년 3월 8일
now it is generating error as -->
Undefined function or method 'erfc' for input arguments of type 'sym'.
Walter Roberson
2013년 3월 8일
Suwas Karki
2013년 3월 8일
MATLAB 7.12.0(R2011a)
Walter Roberson
2013년 3월 8일
erfc() was introduced in R2011b. You can use the integral form of it instead.
Suwas Karki
2013년 3월 14일
편집: Suwas Karki
2013년 3월 14일
I am done with previous problem but now I got new problem. After series of calculation and simplification I came to following inline function,
f00(L) = sqrt(2.0).*sqrt(pi).*(erf(sqrt(2.0).*sqrt(3.0).*sqrt(1.31e2).*(sqrt((log(L.*(7.837318882787328e15./1.964805411538173e17)).*(-1.31e2./6.075e3))./log(1.0e1)+1.31e2./2.0e2)-1.31e2./1.0e2).*(2.5e1./1.31e2))-1.0).*(6.403354352296725e18./3.602879701896397e18)+7.91e2./1.0e2
here f00 is nothing but an inline function which is a function of L and I have to solve the expression to get the value of L using iteration method like Newton Raphson Method. But when solving it is generating error as
??? Error using ==> inlineeval at 15 Error in inline expression ==> sqrt(2.0).*sqrt(pi).*(erf(sqrt(2.0).*sqrt(3.0).*sqrt(1.31e2).*(sqrt((log(L.*(7.837318882787328e15./1.964805411538173e17)).*(-1.31e2./6.075e3))./log(1.0e1)+1.31e2./2.0e2)-1.31e2./1.0e2).*(2.5e1./1.31e2))-1.0).*(6.403354352296725e18./3.602879701896397e18)+7.91e2./1.0e2
Input must be real and full.
Error in ==> inline.subsref at 27 INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
I think the parameter inside erf function became complex that's why i am getting this error. If this is the problem then tell me how can i calculate erf of complex number if not then give me any suggestion how can i tackle this problem ? Thanks in advance
Walter Roberson
2013년 3월 15일
L would have to reach 10^31 for the argument to erf() to become complex.
The solution to L is real valued and positive.
Have you let your test L values become 0? That would involve log(0) ...
As I told you before I have to calculate L by using Newton Raphson Iteration method. I will write part of code here, and A is the expression which is the function of L. If you want I can provide my full code which is not longer (only 62 lines).
%solving A using Newton Raphson Method
A= (6403354352296725483*2^(1/2)*pi^(1/2)*(erf((25*2^(1/2)*3^(1/2)*131^(1/2)*((131/200 - (131*log((7837318882787328*L)/196480541153817325))/(6075*log(10)))^(1/2) - 131/100))/131) - 1))/3602879701896396800 + 791/100
f00=inline(A)
f01=inline(diff(A))
L=2 %initial guess
for i=1:inf
y=L
disp('i = ')
disp(i)
L=y-[f00(L)./f01(L)]
if L==y
break
end
end
L=disp(L)
After running I am getting above errors.
Walter Roberson
2013년 3월 15일
f01 and f00 are both negative near L=2, so you are going to project towards 0. There is a very narrow zone just slightly above 0 where the ratio goes negative, but by the time you get near there you are likely to have projected below 0. And f01 is complex for L negative, leading you to complex L. At that point it seems unlikely you would escape from complex values, as the division of complex numbers seldom will give exact real multiples.
It would be better for your purposes if you could constrain your L to be non-negative.
Suwas Karki
2013년 3월 16일
How can I constrain L to a non negative value, because I have to find the value for L and I am using iteration method for solving it. Is there any other method or way so that I can solve A for the value of L ? Actually I am in the middle of my thesis and I am stuck here. If you can help me here it would be great help for me.
Earlier you indicated that you have to use Newton-Raphson; is that not the case? The symbolic toolbox might be able to solve it (note: it might take a bit of time.) The answer is in the range of L = 1E-30
If you do use an iterative method, you could modify it slightly to add
L = max(L, realmin);
after calculating L.
Suwas Karki
2013년 3월 16일
Actually in my paper which I am taking as base paper for my thesis, the writer has mentioned that we can use various fast and efficient numerical root finding methods such as the Newton Raphson Method, Fixed Point Iteration Method to solve it, so I am thinking about Newton Raphson method but if with Newton Raphson method I am getting error then I think I should change the method. The goal is to find the value for L and I think I can use any method.
And what is this symbolic toolbox is all about how can I use it here ? The expression for A has came from above series of calculation and simplification code now can I use this expression with this symbolic toolbox ?
The symbolic toolbox is the tool that allows "sym" and "diff".
Try this:
feval(symengine, 'numeric::solve', A, L)
Suwas Karki
2013년 3월 16일
I used both of your suggestions. After using your first suggestion i.e
L = max(L, realmin)
after calculating L,
I got the answer L= 3.1783e-030
But after using your second suggestion
feval(symengine, 'numeric::solve', A, L)
I got the answer = [ empty sym ]
I think the answer with the first suggestion is right. So I should go with your first suggestion.
Thank you so much !!
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
태그
참고 항목
2013년 3월 7일
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)
