How to solve an equation with two vectors

4 ビュー (過去 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 Center および File ExchangeConversion 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