Calculating dot product of 2 3 dimensional row vectors
Show older comments
x=input('Enter the 1st pair of 3 vector elements in [square brackets]: ');
if (x~=3);
disp('The vectors elements cannot contain < or > 3 elements.');
else
y=input('Enter the 2nd pair of 3 vector elements in [square brackets]: ');
if (y~=3);
disp('The vectors cannot contain < or > 3 elements.');
else
z=dot(x,y);
disp('The dot product of the entered vectors is: ');
disp(z)
end
Hi,
I am a new user on MATLAB and trying to figure out what is wrong with the code. After the first line, the code does not respond. Any suggestions would be welcome.
Thank you.
3 Comments
Matt J
on 20 Feb 2019
What values did you enter at the prompt?
Mughees Asif
on 20 Feb 2019
Edited: Mughees Asif
on 20 Feb 2019
Rik
on 20 Feb 2019
You are not returning an error, and the code you showed is missing an end.
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!