필터 지우기
필터 지우기

finding the length of a pendulum in motion

조회 수: 3 (최근 30일)
Judith Amulen
Judith Amulen 2011년 2월 9일
When i write the following code, for count = 1:nFrames lab = bwlabel(seg_pend(:, :, count)); property = regionprops(lab, 'Centroid'); pend_centers(count, :) = property.Centroid; end i get an error of "too many outputs requested" how can i correct it?

채택된 답변

Brett Shoelson
Brett Shoelson 2011년 2월 9일
property = regionprops(lab,'Centroid') returns a struct, the fields of which correspond to each ROI (blob) in lab. To convert the centroids of those ROIs into a vector, you might consider something like:
b = reshape([property.Centroid],2,[])';
and then write them en masse to pend_centers.
Or, inside of your for loop, consider writing:
pend_centers(count,:) = property(count).Centroid;
Cheers,
Brett
  댓글 수: 3
Judith Amulen
Judith Amulen 2011년 2월 11일
with the second option, i get an error of "index exceeds matrix dimensions"
Judith Amulen
Judith Amulen 2011년 2월 11일
i don't clearly understand the first option though. could u please explain a little more if you don't mind! thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 2월 9일
You shouldn't try to measure the length of a pendulum in motion. The bottom tip is moving so much faster than the anchor point that you need to take in to account relativistic contraction, but you can't, because you cannot simultaneously measure the position and the velocity (Heisenberg). It is thus advisable to instead wait until the pendulum reaches to top of its arch and thus has a velocity of 0, as you would not need any relativistic correction for the length then.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by