Recent content by samuel1994
-
S
User Defined Functions in MATLAB
Thank you for you help. I figured out the problem. This was my final code: function av = GPA(g,h) for k = 1:length(g) if g(k) == 'A' g(k) = 4; elseif g(k) == 'B' g(k) = 3; elseif g(k) == 'C' g(k) = 2; elseif g(k) == 'D' g(k) = 1; elseif g(k)...- samuel1994
- Post #8
- Forum: Engineering and Comp Sci Homework Help
-
S
User Defined Functions in MATLAB
function av = GPA(g,h) A = 4; B = 3; C = 3; D = 1; E = 0; av = sum(g)/sum(h) This is what I have. I know it's wrong, but I'm merely lost on how to convert the string into numbers.- samuel1994
- Post #3
- Forum: Engineering and Comp Sci Homework Help
-
S
User Defined Functions in MATLAB
Homework Statement Write a user-defined function that calculates grade point average (GPA) on a scale of 0 to 4, where A = 4, B = 3, C = 3, D = 1, and E = 0. For the function name and arguments use av = GPA(g,h). The input argument g is a vector whose elements are letter grades A, B, C, D...- samuel1994
- Thread
- Functions Matlab
- Replies: 8
- Forum: Engineering and Comp Sci Homework Help