1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab function help

  1. Feb 24, 2010 #1
    1. The problem statement, all variables and given/known data
    Implement a matlab function y=radicals(v) that calculates sqrt v(1) + sqrt v(2) +sqrt v(3) +......sqrt v(n). These values are components of v.
    Then I need to write a script to test function. Enter positive integer k. Generate random vector r of length k using rand function. Then calculate following sequence by calling function radicals repeatedly. sqrt r(1), sqrt r(1)+sqrt r(2), sqrt r(1)+sqrtr(2)+sqrt r(3),......
    , sqrt r(1)+sqrt r(2)+sqrt r(3)....+sqrt r(k)

    Save calculated values to a vector seq. Display and plot seq.

    2. Relevant equations

    3. The attempt at a solution

    Set up a function y = radicals(v)

    function y=radicals(v)
    n = 1
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted