http://img16.imageshack.us/img16/3078/15688239.gif [Broken](adsbygoogle = window.adsbygoogle || []).push({});

So here's my script:

So for example I tried x = [70, 50, 30, 45]:Code (Text):x=[a, b, c, d];

w=[0.65 0.2 0.05 0.1]';

final=x*w;

disp(final);

if 65>final>=50

disp('Grade is: C')

elseif 80>final>=65

disp('Grade is: B')

elseif final>=80

disp('Grade is: A')

If final>=50

disp('Student Passes')

else

disp('Student Fails')

end

I got the following answer:Code (Text):x=[70, 50, 30, 45];

w=[0.65 0.2 0.05 0.1]';

final=x*w;

disp(final);

if 65>final>=50

disp('Grade is: C')

elseif 80>final>=65

disp('Grade is: B')

elseif final>=80

disp('Grade is: A')

If final>=50

disp('Student Passes')

else

disp('Student Fails')

end

Well, it calculated the mark correctly, but I don't understand why it says "student fails" when it should be displaying "student passes". It also doesn't display the grade. What's the problem? Can anyone help? :uhh:Code (Text):61.5000

Student Fails

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

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!

# Basic Matlab Programming

Loading...

Similar Threads for Basic Matlab Programming |
---|

MATLAB Basic usage of handles and hObject |

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

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