MATLAB Answers

0

How to solve an equation with two vectors

Asked by Francisco del Bosque on 27 Jun 2018
Latest activity Commented on by Ameer Hamza
on 27 Jun 2018
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;

  0 Comments

Sign in to comment.

Products


Release

R2018a

1 Answer

Answer by Ameer Hamza
on 27 Jun 2018
 Accepted Answer

'%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 Comments

worked like a charm! thank you!
You are welcome.

Sign in to comment.