How can I use MATLAB to plot and sum values using vectors and matrices?

Click For Summary
SUMMARY

This discussion focuses on using MATLAB to plot and sum values derived from vectors and matrices. The user, Kate, seeks assistance with plotting the results of a summation involving a 3x3 identity matrix and vectors defined as j and k1. The correct approach involves using the MATLAB functions symsum and sum to compute the desired values and then plot them accordingly. The identity matrix m plays a crucial role in the calculations, specifically when combined with the vector entries.

PREREQUISITES
  • Understanding of MATLAB syntax and functions
  • Familiarity with vector and matrix operations
  • Knowledge of the symsum and sum functions in MATLAB
  • Basic concepts of plotting in MATLAB
NEXT STEPS
  • Explore MATLAB's symsum function for symbolic summation
  • Learn about vectorized operations in MATLAB for efficient calculations
  • Investigate MATLAB's plotting functions, specifically plot and hold on
  • Study matrix manipulation techniques in MATLAB, particularly with identity matrices
USEFUL FOR

This discussion is beneficial for MATLAB users, data analysts, and engineers who need to perform vector and matrix operations, as well as anyone interested in visualizing mathematical computations in MATLAB.

kobjob
Messages
6
Reaction score
0
Hi everyone,

Could someone please tell me how to get MATLAB to do the following seemingly simple task..

j=1:3;
k1=1:3;
m=eye(3)

plot(j,symsum((p8+k1(j)).*m(p8,j),p8,1,3))

or,

k=1:3;
plot(j,sum((k+k1(j)).*m(k,j)))

Thanks for any suggestions,
Kate
 
Physics news on Phys.org
It would probably help if you wrote the question and what you are trying to do.
 
Well k1 is a vector with entries 1 to 3, k1=(1 2 3).
m is the 3 x 3 identity matrix.

For each j, I want to do the sum from k= 1 to 3
sum((k+k1(j)).*m(k,j)) = (1+k1(j))*m(1,j) + (2+k1(j))*m(2,j) + (3+k1(j))*m(3,j)

Then I want to plot the values of the sum for each j.
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
2K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
3
Views
2K
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K