Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

elica85 Group Title

can anyone help with Matlab?

  • one year ago
  • one year ago

  • This Question is Closed
  1. hali Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    What problem are you facing in Matlab?

    • one year ago
  2. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i have to write a program for this problem... determine the number of terms necessary to approximate cosx to 8 significant figures using the Maclaurin series approximation. use x=0.3pi \[cosx=1-(x ^{2}/2)+(x ^{4}/4!)-(x ^{6}/6!)+(x ^{8}/8!)...\] i don't know where to begin. I took Matlab 2 summers ago and the school and instructor was horrible and i'm not just saying this. the instructor stayed on the first 2 chapters (learning the basic functions) for half the semester and barely taught us how to write our own programs. i think she's fired.

    • one year ago
  3. phi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Here is matlab that should work % cos(x) = 1 - (x^2)/2! + (x^4)/4! -(x^6)/6!+(x^8)/8!... % let y= x*x % cos(x) = sum( (-y)^n/(2n)! ) format short x= 0.3*pi; y= x*x; for N= 1:6 n= 0:N; s1= [(-y).^n./factorial(2*n) ] mac= sum(s1); cx= cos(x); str= sprintf('%d terms. series: %12.10f cos(x): %12.10f\n %12.10f',... N, mac,cx, (cx-mac)); disp(str); end;

    • one year ago
  4. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    differetiate cos(x) iteratively at x=0 y = cos (t) loop { y = diff( y , t); sub(y, 0) } find the coefficients ... use the usual method.

    • one year ago
  5. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @phi thx, did you solve the problem to 10 sig figures?

    • one year ago
  6. phi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    It prints out more than 8. I'll leave it to you to count the digits

    • one year ago
  7. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ok, how do i format the number of digits? so far i was able to find the commands "short", "long", but not exact number of digits i want

    • one year ago
  8. phi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    try running the program. the sprintf statement formats using the C style formatting %12.10f means use 12 places (includes decimal point), with 10 places to the right of the decimal

    • one year ago
  9. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ok, i'll try thx

    • one year ago
  10. phi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Although be careful, because I can't count! where it says it is using n terms, it is really using n+1 terms, counting the initial 1

    • one year ago
  11. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i'm actually really confused and writing everything out on paper to see where everything fits. why is y=x*x, if s1 suppose to equal the explicit form of the mac series, why is it (-y)^n instead of (-1)^n and where's x^(2n)? i'm comparing to the explicit form: \[cosx=\sum_{n=0}^{\infty} \frac{ (-1)^n }{ (2n)! } x ^{2n}\]

    • one year ago
  12. phi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    you do know \( x^{2n} = (x^2)^n \), right? and \( (-1)^n \cdot (x^2)^n= (-x^2)^n \)

    • one year ago
  13. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ok thx

    • one year ago
  14. phi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    It just makes the code a little bit simpler (or maybe just a little bit more indecipherable).

    • one year ago
  15. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ok, and back to the number of decimal places...how would changing the %12.10f change anything since it's after %?

    • one year ago
  16. phi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    See above for the explanation. %12.0f would print out up to 11 digits plus the decimal point with 0 of the digits to the right of the point. It is easier to play with it.

    • one year ago
  17. elica85 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    it worked. thx again for the help

    • one year ago
    • Attachments:

See more questions >>>

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.