How to automate a process?

조회 수: 1 (최근 30일)
Sebastian Ciuban
Sebastian Ciuban 2013년 5월 2일
  • Note: English is not my first language and I may be not very explicit.
I have the input data:- matrix A(3,2)=[683265.032 465089.623; 683248.660 464977.521; 683303.746 465039.114].
-_Function ,,Orientation"_ which contains this formula: *atan((B(1,2)-A(1,2))/(B(1,1)-A(1,1)))*200/pi*.
And this matrix B(3,3)-output data: B=[-1 Orientation(A(1,:),A(2,:)) Orientation(A(1,:),A(3,:)); Orientation(A(2,:),A(1,:)) -1 Orientation(A(2,:),A(3,:)); Orientation(A(3,:),A(1,:)) Orientation(A(3,:),A(2,:)) -1];
  • "-1" means that Orientation to the same point can't be calculated.
So far so good by now. But what if I want to add 2 more rows of coordinates in matrix A? I want matrix B to calculate, using function "Orientation", regardless of how many sets of coordinates matrix A contains (rows). I don't want to write manually the commands in B every time I add new data to A. It is possible to automate this process?
  댓글 수: 2
Jan
Jan 2013년 5월 2일
The question is not clear. Are the functions "Orientation" and "Orientare" identical?
Sebastian Ciuban
Sebastian Ciuban 2013년 5월 2일
Yes they are. Sorry, my mistake

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

채택된 답변

Jan
Jan 2013년 5월 2일
I do not understand the question completely. Perhaps you are looking for:
function R = Orientation(A, B)
R = atan((B(:, 2) - A(:, 2)) ./ (B(:,1) - A(:,1))) * (200/pi);
  댓글 수: 1
Sebastian Ciuban
Sebastian Ciuban 2013년 5월 2일
In my example i have A(3,2) and the calculated matrix B(3,3) with the function Orientation. I want to make matrix B to be calculated regardless of number of lines that matrix A have.
for A(n,2) I want B(n,n) to be calculated with that function

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by