13 views (last 30 days)

Show older comments

Hey everyone.

I'll be honest with you, I have no idea what I'm doing here but I'm not asking for answers and instead I'm willing to struggle for them. I'm a civil engineering senior with a minor in applied mathematics. I've taken a basic computer science course my freshmen year but it wasn't very informative (consisted mostly of vocab and lectures and not very much practice) and I've forgotten everything since.

For my last math class I've been given a problem where I've been asked to plot a bivariate normal distribution, with a standard deviation of 1, a mean of 0, and four different correlation coefficients of 0.9, -0.9, 0, and 0.5. Each of these is to be plotted on its own graph, and then four scatter plots should be plotted for each of these graphs using a random sample from a random number generator.

What I really need is a hand on getting this started in matlab. I know this might sound like a lot and again I'm not trying to get you to do my project for me, but I don't think rusty is a strong enough adjective to describe my matlab skills.

Many thanks

the cyclist
on 23 Apr 2014

That's an honest appeal, and refreshing compared to those who post word-for-word homework problems and don't seem to realize how transparent they are being. Here are two tidbits that might help get you kick-started.

First, try to get firmly in mind whether you understand mathematically (not MATLAB-ly) what you think you are plotting. Could you draw it roughly by hand?

Second, take a look at the MATLAB Plot Gallery. This will give you a bird's eye view of several types of MATLAB plots, with the ability to then download the code that created them. You may find something that is close to what you need, that you will be able to adapt.

the cyclist
on 25 Apr 2014

You can store the matrices in a cell array:

c = {[0.9 0; 0 0.9],[0.5 0; 0 0.5]}; % Two matrices stored in a cell array

Then, when you go through the loop, you can reference

c{i}

to access each matrix.

Rahul Gulia
on 21 Aug 2020

I was actually looking into similar kind of problem. And i found solutions that could answer your problem quite properly.

Here are all the relevant links that i am referring from too.

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

Start Hunting!