Hi all,
I am having trouble with user-defined functions in matlab.
I want to add up 'n' numbers in a summation for a function.
The equation, without values plugged in, is this:
(It is about equivalence resistance)
1/REQ = 1/r1 + 1/r2 + 1/r3 + 1/r4 + 1/r5 +....+ 1/rn
You get the point.
So Here is my work for matlab:
Function:
function [REQ] = req(r)
req=1/sum(1./r);
return
And this is my script file:
req_1=req(50,75,300,60,500,180,200)
The seven inputs being what needs to go into the function.
Thanks for any help!
Ok well here is my error that I get:
Error in ==> req at 3
req=1/sum(1./r);
??? Output argument "REQ" (and maybe others) not assigned during call to "/u/m152_806/dillonmhudson91/EngrMath/Gilat/c6/g188x15/req.m>req".
Error in ==> g188x15 at 6
req_1=req([50,75,300,60,500,180,200]);