Computing values from a subsection of a data file
조회 수: 1 (최근 30일)
이전 댓글 표시
Greetings all,
As I brush the rust off of MATLAB gradually ;) I'm trying to compute values from a particular data file for a simulation I am doing. The problem is, the results aren't quite right, except for the first value.
So my code is:
z1 = data(1:10,2);
Rz1 = 1/(sqrt(4*z1.^2 + 1))
Now, data(1:10,2) is from my data file where elements 1 through 10 in column 2 are all zero, and according to the equation I stated at Rz1, all the results should be one (so in essence a row of 10 ones). But I get 1 0 0 0 0 0 0 0 0 0 0 as my output, which is not correct.
Can someone point out my mistake? I figure I'll ask this now since my computation gets more complex from here on out, so I want to get it right.
Thanks!
Jesse
댓글 수: 0
채택된 답변
Fangjun Jiang
2011년 12월 29일
Very close. Just missed one dot.
%z1 = data(1:10,2);
z1=zeros(10,1);
Rz1 = 1./(sqrt(4*z1.^2 + 1))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!