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

mukushla Group Title

what is this error in MATLAB???

  • 2 years ago
  • 2 years ago

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

    ??? Output argument "G" (and maybe others) not assigned during call to "C:\Users\Sepehrinia\Desktop\Matlab1\bairstow.m>bairstow".

    • 2 years ago
  2. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    @experimentX

    • 2 years ago
  3. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    just take a look and see if you know this or not...i dont wanna waste your time so much

    • 2 years ago
  4. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    probably you haven't define G before you used it.

    • 2 years ago
  5. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    i have a : function G = bairstow(a,r,s) when i call this other place it gives me that error

    • 2 years ago
  6. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    just call function bairstow(a,r,s) on your console and see what happens

    • 2 years ago
  7. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    thats error again :(

    • 2 years ago
  8. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    can you post the whole code for that function?

    • 2 years ago
  9. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    no this function? did you code it yourself? bairstow( ... )

    • 2 years ago
  10. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    yeah

    • 2 years ago
  11. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    could you send the code of that function?

    • 2 years ago
  12. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    its the bairstow method for solving P(x)=0 P(x) is a polynomial

    • 2 years ago
  13. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    is it defined inside matlab?

    • 2 years ago
  14. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    no i code it myself

    • 2 years ago
  15. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    lol ... could you send me that code?

    • 2 years ago
  16. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    lol...man thats up there function G=...

    • 2 years ago
  17. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    woops ... didn't see that!!

    • 2 years ago
  18. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    have you assigned G= something inside bairstow.m??

    • 2 years ago
  19. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    i think no

    • 2 years ago
  20. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    Yup ... that's the problem. Put G = 0 at the end of bairstow.m

    • 2 years ago
  21. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    or out G = ... the value where you are outputting ... I can't even read your code. you sure know how to do complex thing.

    • 2 years ago
  22. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    let me try it

    • 2 years ago
  23. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    thank u man...thats fine :)

    • 2 years ago
  24. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    man u saved my life

    • 2 years ago
  25. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    lol ... no probs man!! someday it might be useful to me too .. :D

    • 2 years ago
  26. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    i was stuck here for one and half hour

    • 2 years ago
  27. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    haha ... happens sometimes :D

    • 2 years ago
  28. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    santosh copy the hole thing and run it...see what happens

    • 2 years ago
  29. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    and in end of the function according to what u said turn [X1(1:end) X2(1:end) x3] to G=[X1(1:end) X2(1:end) x3] and [X1(1:end) X2(1:end) y3] to G=[X1(1:end) X2(1:end) y3]

    • 2 years ago
  30. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    ??? Attempted to access q(2); index out of bounds because numel(q)=1. Error in ==> test at 6 z2(p)=q(2);

    • 2 years ago
  31. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    Woops ... with changing that part ??? Attempted to access q(2); index out of bounds because numel(q)=1. Error in ==> test at 6 z2(p)=q(2);

    • 2 years ago
  32. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    function G = bairstow(a,r,s) A=a(2:end); m=length(A); k=1; while m>2 b1=1; b2=1; while abs(b1)+abs(b2)>0.0000001 b(m)=0; b(m-1)=0; for i=m+2:-1:5 b(i-4)=A(i-2)+r*b(i-3)+s*b(i-2); end b0=A(2)+r*b(1)+s*b(2); b1=A(1)+r*b0+s*b(1); b2=a(1)+r*b1+s*b0; c(m-2)=0; if m>3 c(m-3)=0; else c(2)=0; end for i=m:-1:5 c(i-4)=b(i-2)+r*c(i-3)+s*c(i-2); end c0=b(2)+r*c(1)+s*c(2); c1=b(1)+r*c0+s*c(1); c2=b0+r*c1+s*c0; c3=b1+r*c2+s*c1; deltar=(c1*b2-c2*b1)/(c2^2-c1*c3); deltas=(c3*b1-c2*b2)/(c2^2-c1*c3); r=r+deltar; s=s+deltas; end X1(k)=(r+sqrt(r^2+4*s))/2; X2(k)=(r-sqrt(r^2+4*s))/2; k=k+1; A=b(1,1:m-2); a(1)=b0; m=m-2; r=1.1*r; s=1.1*s; end if b(2)==0 x3(1)=-b0/b(1); G=[X1(1:end) X2(1:end) x3]; else y3(1)=(-b(1)+sqrt((b(1))^2-4*b0*b(2)))/(2*b(2)); y3(2)=(-b(1)-sqrt((b(1))^2-4*b0*b(2)))/(2*b(2)); G=[X1(1:end) X2(1:end) y3]; end

    • 2 years ago
  33. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    test.m is my file where i pasted your running code.

    • 2 years ago
  34. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    K=linspace(0,8,2000); p=1; for i=1:length(K) q=bairstow([6+6*K(i) 11 6 1],2,2); z1(p)=q(1); z2(p)=q(2); z3(p)=q(3); y3(p)=0; p=p+1; end plot(z1,'.') hold on plot(z2,'.g') plot(z3,y3,'.r') axis([-4 1 -3 3])

    • 2 years ago
  35. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    sorry man i gotta go see u later :)

    • 2 years ago
  36. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    and besides that error i get

    • 2 years ago
    1 Attachment
  37. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    sure ... anytime :)

    • 2 years ago
  38. mukushla Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    yeah thats exactly what i wanted cya my friend

    • 2 years ago
  39. experimentX Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    cya !!

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