1) COOLnumbers are the sequence 1, 1, 2, 3, 5, 8, 13, 21, 34 … As you can (probably) see, each COOL number is the sum of the previous two. ugly numbers, on the other hand, are the sum of the previous three.
a. Find the 19th and 119th ugly numbers.
b. Use “bar” to give a bar plot of the first 10 ugly numbers. Label your axes.
c. Plot the first 100 ugly numbers on a logarithmic y-scale. Do you notice anything? What might it mean?
Can anyone help me make this script for matlab?
or you could solve the recurrence and code the solution as a function of nCode:TriNacci=zeros(1:100); TriNacci(1:3)=[1,1,2]; %put the three initial values here for idx=4:100 TriNacci(idx)=TriNacci(idx-3)+TriNacci(idx-2)+TriNacci(idx-1); end
i need help doing the bar plot....
Find1 = u(19);
Find2 = u(119);
That's the program and it works for what i want to find.
How to I do the bar plot part..
* a. Use “bar” to give a bar plot of the first 10 ugly numbers. Label your axes.*
I Tried doing like bar (range(1:10))*u or something but that doens't seem right... Hope you can help