1

I have this code but I get error. It just does not run.

m=vander(2:4)';
e=m(2:3,:);
r=e(end:-1:1);
r=[-r,0,r(end:-1:1)];
y=kron([3,6,8],[1,1]);
x=[y,10,y(end:-1:1)];
m=@()rand(151,1)*10;
a=m()-5;
s=m();i=inpolygon(a,s,r,x);hold on;
fill(r,x,'g');plot(-a(inpolygon(a,s,r,x)),s(inpolygon(a,s,r,x)),'-y','LineW',8);plot(a(inpolygon(a,s,r,x)),s(inpolygon(a,s,r,x)),'.r',[109 97 114,'',107 101 114 115],50)

Added

Now it works, thanks @excaza!

https://i.stack.imgur.com/KzVex.png

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Could you at least try to format your question so we can read it? – Suever Dec 24 '16 at 19:32
  • What is the value of `i` – Suever Dec 24 '16 at 19:33
  • Why are you trying to index into `m` with a variable you haven't defined yet (and is the complex number `1j`). The statement `m(i)` literally does nothing – Suever Dec 24 '16 at 19:36
  • Can you test it ? Matlab does not work anymore and I cannot close! – matlab_error Dec 24 '16 at 19:37
  • If you remove m(i)? – matlab_error Dec 24 '16 at 19:37
  • @Suever Please help I my matlab program does not work, I just want run this program! – matlab_error Dec 24 '16 at 19:41
  • @Suever Can you help please? I made my question post better now! But my matlab crash! – matlab_error Dec 24 '16 at 19:45
  • Your edited code functions correctly for me, it's a Christmas tree. Try `clear all` or restarting MATLAB. – sco1 Dec 24 '16 at 19:46
  • @excaza What christmast tree, it must be program!? Can you post picture? – matlab_error Dec 24 '16 at 19:47
  • 2
    [Christmas tree](http://i.stack.imgur.com/KzVex.png) – sco1 Dec 24 '16 at 19:48
  • 1
    Oohh thank you <3 חג שמח חנוכה שמח – matlab_error Dec 24 '16 at 19:50
  • This question has rather gotten into a pickle. Please take the time to read the help pages, and to read good questions on the site, so you get to know how Stack Overflow works. Please do not add objections to closure/voting in your questions, especially not in the title. Do not ask people to run things on their own machine, or to fix them for you - that is your job. Don't wait to be asked to format your code in a readable fashion. Don't put your error message only in the title and then, in a later edit, reword the title entirely. – halfer Dec 25 '16 at 00:58
  • Try to avoid using txtspk "plz" and don't beg for "halp". These rules are mostly not specific to Stack Overflow - they would apply to any site where questions and answersare intended to be kept as a learning resource well into the future. – halfer Dec 25 '16 at 00:59

0 Answers0