필터 지우기
필터 지우기

Diagonal of a quadrilateral

조회 수: 1 (최근 30일)
Dorothy Carter
Dorothy Carter 2015년 11월 10일
편집: Thorsten 2015년 11월 10일
How do you determine the length of one diagonal of a quadrilateral using a user defined function. The input parameters are AB, BC, CD, DA, AC. Find DB. Here is what I have so far: Function(quadrilateral): function x=quadrilateral(AB,BC,CD,DA,AC) x=DB=(DA*(BC)+AB*(CD))/AC end Script: x=quadrilateral(9,3,4,5,6) disp(x) How do I define the function 'x' in such a way so that the equation for finding the diagonal of a quadrilateral is assigned to it?
  댓글 수: 1
Adam
Adam 2015년 11월 10일
'x' is a variable and your code appears to already do that, in so much as it assigns the output of your function to 'x', I haven't checked that the body of your function is correct.

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

채택된 답변

Thorsten
Thorsten 2015년 11월 10일
편집: Thorsten 2015년 11월 10일
Just get rid of the "DB ="
function x=quadrilateral(AB,BC,CD,DA,AC)
x=(DA*(BC)+AB*(CD))/AC;
Alternatively, of course, you could also rename x to DB in your function, if you prefer this:
function DB=quadrilateral(AB,BC,CD,DA,AC)
DB=(DA*(BC)+AB*(CD))/AC;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by