trouble creating a matrix from table data

Hi, Im' new to matlab, and trying to work through a problem.
I have a table, called 'HD', it's 1 column by 499 rows.
I want to create 'Ry' for each of the rows through a 3x3 matrix
Ry = row 1: [cos(HD) -sin(HD) 0]
row 2: [sin(HD) cos(HD) 0]
row 3: [0 0 1]
I've written: Ry = [cos(HD) -sin(HD) 0; sin(HD) cos(HD) 0; 0 0 1]; but it didn't work then I tired creating tables' for each: cos(HD) -sin(HD)... and substituted the new table names in the command, but it didn't like that either. Any assistance is greatly appreciated. Dana

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 9월 22일
편집: Azzi Abdelmalek 2012년 9월 22일

0 개 추천

HD=rand(1,499);
Ry1= [cos(HD); -sin(HD) ;zeros(1,499)]
Ry2= [sin(HD); cos(HD); zeros(1,499)];
Ry3= [zeros(1,499); zeros(1,499); ones(1,499)];
Ry=[Ry1;Ry2;Ry3]
out=reshape(Ry,3,3,[])

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

질문:

2012년 9월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by