calculate the value by using a formula
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
How to calculate the error(pls see the attachment-pg1)? (data and formula is written in the attachment) Do i have to use a for loop here? How to solve this problem?
채택된 답변
Michael Haderlein
2015년 2월 18일
Dou you mean
err=sqrt(sum((M-P).^2)/numel(M));
I guess "i" does not go to infinity but only to 2000 and the data in your file is incomplete and should have 2000 values each (M and P).
댓글 수: 7
@ Michael- thank you so much for your response. I have attached the original data set.
The issue i am having here is something very obvious: i obtained M=104 and P=100 values when i run my code. How can i take off the zeros(Pls look at the M sheet) out of the data set and make 1st value to zero. My purpose here is to make M and P dimensions same. Can you kindly tell me how to overcome this issue?
To remove the zeros:
M(M==0)=[];
But I see only two zeros (7 and 42), so M will still have more elements than P. Also, this means you shift M. Whether this is a problem or not depends on the case.
If you want to ensure to always take the first values, you can use
minL=min(numel(M),numel(P);
and apply it with
err=sqrt(sum(M(1:minL)-P(1:minL).^2)/minL);
This will simply ignore the extra values at the end of your arrays.
Chathu
2015년 2월 19일
Micheal- thank you so much for your response.
You are right, if i remove zeros i am shifting M. I totally forgot that point-my mistake:( but thanks for pointing it out. Can i ask you my qu in different way(sorry, i would have asked it earlier) Suppose i want to:
1)Make 1st M and P value to zero 2) Afterwards,make M and P dimensions same. So then i can calculate the error. Is it possible to do?
If you want to set a value to zero, just do it:
M(1)=0;
In my code above, values at the end of the array are just ignored. If you want to delete values at the end of your data to equalize the size, just do it with
M=M(1:minL);
P=P(1:minL);
The definition of minL is like shown in the previous post.
Michael- thank you so much for your time and effort. Really appreciate your help. I am getting a value(see below) like this. 0.0000e+00 + 4.3938e+12i
I wonder why i am getting an 'i' here? do you have any idea?
Torsten
2015년 2월 20일
err=sqrt(sum((M(1:minL)-P(1:minL)).^2)/minL);
Best wishes
Torsten.
Chathu
2015년 2월 20일
@ Torsten- Perfect !!!
Finally i obtained estimated values for the error. Thank you sooo much. Appreciate it.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
태그
아직 태그를 입력하지 않았습니다.
참고 항목
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)
