필터 지우기
필터 지우기

How to solve an equation with two vectors

조회 수: 1 (최근 30일)
Francisco del Bosque
Francisco del Bosque 2018년 6월 27일
댓글: Ameer Hamza 2018년 6월 27일
I am trying to make vector equations for line segments. I have both the vectors and the equation for it, but it wont let me use fprintf to display it. please show me what to fix!
syms t
A=[-7,3,-1]; B=[1,0,5];
v=((1-t)*A)+(t*B);
fprintf('The vector equation for the line segment is <%g,%g,%g>\n',v)
clear;

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 6월 27일
'%g' is for numeric type, since your v vector is sym, therefore, you need to use '%s'
syms t
A=[-7,3,-1]; B=[1,0,5];
v=((1-t)*A)+(t*B);
fprintf('The vector equation for the line segment is <%s,%s,%s>\n',v)
clear;
  댓글 수: 2
Francisco del Bosque
Francisco del Bosque 2018년 6월 27일
worked like a charm! thank you!
Ameer Hamza
Ameer Hamza 2018년 6월 27일
You are welcome.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by