A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 5 years ago
Can anyone please help me to write this matlab mfile?
Here is the pseudocode :
http://oi53.tinypic.com/u1pvc.jpg
anonymous
 5 years ago
Can anyone please help me to write this matlab mfile? Here is the pseudocode : http://oi53.tinypic.com/u1pvc.jpg

This Question is Closed

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0function y=lgrng(x,y,i,j) sum = 0 ; while i = 0,n product = yi; while j = 0,n if a ~= b then product = product * ( x  xj ) / (xi  xj) end end sum = sum + product; end print sum; end

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0this is what i tried to write,too bad it didn t work.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Of course not, you tried to paste the algorithm into a .m without regard to Matlab syntax and the picture algorithm is badly written. I can't tell if it means a do while or for loop or what types of inputs you are using (vectors, constants, etc).

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I'll get you started off, but I have no idea about you are attempting to accomplish, what test cases you have, what the inputs are or what information you have about this. You have two inputs with the same name. I recommend including better info in the future... function sum = test(x, y, n) % assuming y is a vector % assuming x is a vector sum = 0; for i = 1 : n product = y(i); for j = 1 : n if i ~= j product = product .* (x  x(j)) ./ (x(i)  x(j)) end end sum = sum + product; end return

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0It seems from the picture that there is another parameter 'X'. you should name it differently as JD pointed out. otherwise this line 'product = product .* (x  x(j)) ./ (x(i)  x(j))' won't work. Try change x into x1 and include it into the function at the first line. Good luck

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Assuming x is a vector, you are subtracting a scalar from a vector (which is fine), dividing a vector by a scalar (which is fine) and multiplying each vector element by a scalar (which is fine).

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0yeah, but can't figure out what this function is trying to do. This is a real problem.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0hi guys,sorry for the late reply,thank you very much for your help. and here is the whole question: http://oi55.tinypic.com/20r4ryp.jpg
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.