Hi--I have two vectors ##x=(x_1, x_2, ..., x_n)## and ##y=(y_1, y_2, ..., y_n)##.(adsbygoogle = window.adsbygoogle || []).push({});

Now I want them to be multiplied in the following way:

for each ##i=1,2,..,n##, I need ##x_i*y_{i-1}-y_n##.

Can anyone help me on how to code this in Matlab?

BTW, I also want to input the length of the two vectors ##n## at the very beginning of the program. What do I need to do in order ensure the lengths of vectors ##x## and ##y## are the ##n## I specified as an input?

Thanks in advance!

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB A Q on multiplying two vectors

Have something to add?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**