Assigning equation output to second row of a matrix

조회 수: 2(최근 30일)
I have a 3x1 Matrix containing 3 values for my velocity and I'm trying to divide these 3 values by 5 different values for thrust. To create 1 matrix that is 3x5 with each row equaling my velocity1/thrust1, velocity1/thrust2. The next row would equal velocity2/thrust1, velocity2/thrust2. etc. Ultimately I 'm trying to plot the results in each row on the same plot. If there is a better way of doing this please let me know. I have attached a picture to help explain. Thank you in advance
Edit: for the graph I'm plotting the row on the y axis and the thrust on the x axis

채택된 답변

Steven Lord
Steven Lord 2023년 3월 21일
Implicit expansion.
velocity = (1:3).'; % column vector
thrust = 10:14; % row vector
A = velocity./thrust % Dividing results in a matrix
A = 3×5
0.1000 0.0909 0.0833 0.0769 0.0714 0.2000 0.1818 0.1667 0.1538 0.1429 0.3000 0.2727 0.2500 0.2308 0.2143
If you prefer seeing them in rational form:
format rat
A =
1/10 1/11 1/12 1/13 1/14 1/5 2/11 1/6 2/13 1/7 3/10 3/11 1/4 3/13 3/14

추가 답변(0개)


Find more on 2-D and 3-D Plots 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!

Translated by