MATLAB Converting Matrix Dimensions in MATLAB

AI Thread Summary
To plot data using the pcolor command in MATLAB after solving a system of linear equations with the finite difference method, it is necessary to convert the N x 1 solution vector back into its original matrix form. This can be achieved by using the reshape function, which allows the user to specify the desired number of rows (nr) and columns (nc) such that the product of nr and nc equals N. The correct syntax for this operation is: solution_matrix = reshape(solution_vector, nr, nc). This method effectively transforms the solution vector into a matrix suitable for plotting.
pige
Messages
3
Reaction score
0
Hello, first post, probably a beginner question, but I am stumped.

I modeled a set of data in MATLAB using the finite difference method. I then solved the system of linear equations and the solutions are in an N x 1 matrix. The problem is, I need to use the pcolorcommand to plot it and need it back in the original square or rectangular form. I tried using a nested loop to take the values back but couldn't succeed. Any help is appreciated.
 
Physics news on Phys.org
Last edited by a moderator:
Back
Top