# Generating & Plotting Graphs in MATLAB

• M11
In summary, the person is trying to generate 1000 normally distributed random numbers and plot the scatter and histogram graphs. They have used the randn(1000) function to generate the numbers, and are now looking for a way to plot the graphs. They are advised to use a histogram plot to see the distribution of the points. MATLAB also has a built-in function for this.

hi,

## Homework Statement

I am asked to generate 1000 normally distributed random numbers and then plot the scatter and histogram graphs of the data.

## The Attempt at a Solution

I used : randn(1000) and it generated the random number, now how can I plot the graphs?

from where can I get the other variable?

I would suggest using the "scatter" and "histogram" functions in MATLAB to plot your graphs. These functions require two variables - the x and y coordinates for the scatter plot, and the data for the histogram. In this case, you can use the same set of 1000 random numbers for both plots. You can also specify the number of bins for the histogram using the "histogram" function. I would recommend consulting the MATLAB documentation or seeking help from a colleague or a tutor if you are unsure about how to use these functions. Additionally, it may be helpful to label your axes and add a title to your plots for clarity. Good luck!

## What is MATLAB?

MATLAB is a high-level programming language that is commonly used in scientific and engineering applications. It is also an interactive environment for numerical computation, data analysis, and visualization.

## How do I generate a graph in MATLAB?

To generate a graph in MATLAB, you will first need to input your data into the program. Then, you can use the various built-in functions and commands to plot the data in a desired format. You can also customize your graph by adding labels, titles, and adjusting the axes.

## What types of graphs can I create in MATLAB?

MATLAB offers a wide range of options for graph types including line graphs, scatter plots, bar charts, histograms, and more. It also allows for 3D graphs and animations.

## How can I save and export my graph in MATLAB?

To save your graph in MATLAB, you can use the "saveas" function and specify the desired file format. This will save the graph as an image or a vector graphic that can be exported to other programs. You can also copy and paste your graph directly into other applications.

## Can I customize the appearance of my graph in MATLAB?

Yes, you can customize various aspects of your graph such as color, line style, and marker type. You can also add annotations, legends, and adjust the size and position of the graph within the figure window. Additionally, MATLAB allows for the creation of custom functions and scripts to further customize your graphs.