Hey everyone,(adsbygoogle = window.adsbygoogle || []).push({});

I just started, what is supposed to be a beginners course in MatLab, but I am the only one who has never used MatLab before! I'm stuck on the very first HW assignment (although I did manage to get to problem 6 out of 7) and was hoping someone could explain why I keep getting an error message.

The question reads:

Make one 2D plot for 0≤x≤1 containing the following 6 functions

f(x) = x

g(x) = r x (1-x)

with r={0.5, 1.5, 2.5, 3.5, and 4}. Label the axes, choose very different line styles for each curve, and add a legend for each curve. Please insert the resulting graph here. For what values of r do f(x) and g(x) intersect?

Here is what I was trying to do:

>> x=0:0.1:1

>> r=[0.5 1.5 2.5 3.5 4]

>>y1=x

>>y2=r*x*(1-x)

--> This is where I get an error! What am I doing wrong? How do I get around this?

Thank you!!!

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB 2D plotting error help please

Have something to add?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**