How to do this in Matlab?

1 vue (au cours des 30 derniers jours)
Shing Sheung Mak
Shing Sheung Mak le 17 Oct 2018
Réponse apportée : Luna le 17 Oct 2018
1.Create a 100 X 100 random matrix (use the command randn) called B.
2.From B, create a matrix K which is a random matrix from a normal distribution with mean 4 and variance 16.
3.Create two vectors, v and z, which are respectively the first and the last row of K.
4.Plot v and z in the same graph, using as horizontal axis a vector t which contains the first 100 natural numbers.
5. The line of v must be red, a solid line, and the marker must be a circle. The line for z must be green, a dashed line, and the marker must be a star.
6. Add a legend to the plot.
  1 commentaire
Steven Lord
Steven Lord le 17 Oct 2018
This sounds like a homework assignment. If it is, show us what you've tried to solve the problem and describe specifically where you're having difficulty and we may be able to offer some guidance.
If you're not sure even where to start, I recommend either contacting your professor or teaching assistant or going through the tutorials in the Tutorials section on the Support webpage. The MATLAB Onramp tutorial should cover most if not all of the topics you'd need to complete that assignment.

Connectez-vous pour commenter.

Réponse acceptée

Luna
Luna le 17 Oct 2018
Hi Shing
I can only recommend you which functions you should look at with their links below:
1) First look at randn function in below link:
2) For this you can use normpdf function to create a random matrix according to your mean and standart dev.
3) Your K is a matrix so you can get first and last row using below:
v = K(1,:)
z = K(end,:)
4) For plotting check the plot function below:
To plot 2 lines in a figure use the below command:
hold on
link for hold:
To create your natural numbers t use this:
t = 1:1:100
5) & 6) you can look plot function in details for color&marker style.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by