1 view (last 30 days)

Hello community,

I am beginner in Matlab. I am struggling with the following exrcises. I only managed to answer 1 & 5 however the others confuse me and I don't even know how to start specially with 2 & 3. Please I need your help

My solutions:

%Exercise 1

x = [2:3:89]

%Exercise 5

function density=ExamC()

x=input('Please enter x: ');

m=input('Please enter mean: ');

s=input('Please enter standard deviation: ');

f=1/(s*sqrt(2*pi))*exp(1)^((1/2)*((x-m)/s)^2);

disp('Value of density is: '), disp(f);

end

Thank you for your help,

Abdel

per isakson
on 24 May 2020

Exercise 1 and 2

"[...] however it confuses me the way the question is written!" Agree; the very same vector has three different names, x, vec and v. (It might be about level of abstraction; an effort to distiguish between the vector and its representation in Matlab.)

Exercise 3.

The text is ok.

Exercise 4.

There are relevant examples in the documentation on plot()

Exercise 5.

The statement

function density=ExamC()

doesn't follow the instruction. The last sentence says

function f = density( x, m , s )

(to my best understanding)

Opportunities for recent engineering grads.

Apply Today
## 5 Comments

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_859888

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_859888

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_860933

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_860933

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_860958

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_860958

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_860983

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_860983

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_861463

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/531683-basic-queries-matlab-vectors-indexing-construct-matrices-in-a-specific-form#comment_861463

Sign in to comment.