Converting Matrix Dimensions in MATLAB

Click For Summary
SUMMARY

The discussion focuses on converting an N x 1 matrix back into its original rectangular form in MATLAB for visualization using the pcolor command. The user modeled data using the finite difference method and solved a system of linear equations, resulting in a solution vector. The recommended solution is to utilize the reshape function to convert the solution vector into a matrix of size [nr, nc], ensuring that the product of nr and nc equals N.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of matrix dimensions and manipulation
  • Knowledge of the finite difference method
  • Experience with plotting functions in MATLAB, specifically pcolor
NEXT STEPS
  • Research the MATLAB reshape function for matrix manipulation
  • Explore the finite difference method for solving differential equations in MATLAB
  • Learn about MATLAB's pcolor function for visualizing matrix data
  • Investigate best practices for handling matrix dimensions in MATLAB
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those involved in numerical modeling, data visualization, and anyone needing to manipulate matrix dimensions for effective 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:

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
2K