While Loop on Matlab

Can anybody please save my ass?
I need to hand in this excercise but I don't get how to apply these while loops properly.

give me a minute

while tobefair
you have to have a very high IQ to understand Rick and Morty. The humour is extremely subtle, and without a solid grasp of theoretical physics most of the jokes will go over a typical viewer’s head. There’s also Rick’s nihilistic outlook, which is deftly woven into his characterisation- his personal philosophy draws heavily from Narodnaya Volya literature, for instance. The fans understand this stuff; they have the intellectual capacity to truly appreciate the depths of these jokes, to realise that they’re not just funny- they say something deep about LIFE. As a consequence people who dislike Rick & Morty truly ARE idiots- of course they wouldn’t appreciate, for instance, the humour in Rick’s existential catchphrase “Wubba Lubba Dub Dub,” which itself is a cryptic reference to Turgenev’s Russian epic Fathers and Sons. I’m smirking right now just imagining one of those addlepated simpletons scratching their heads in confusion as Dan Harmon’s genius wit unfolds itself on their television screens. What fools.. how I pity them.

And yes, by the way, i DO have a Rick & Morty tattoo. And no, you cannot see it. It’s for the ladies’ eyes only- and even then they have to demonstrate that they’re within 5 IQ points of my own (preferably lower) beforehand. Nothin personnel kid
end

xDDD

I'll wait all night

function[value] = fibonacciValue(m)
%Note: m should be integers greater than or equal to 1.

value = [1 1];
i=2;
while value(i) < m


value(i+1) = value(i)+value(i-1);
i= i+1;

end

if value(end) > m
value = value(1:end-1);
end
end


I haven't really tested this yet but it should work

holy crap, you actually did it, thanks tons!
you're awesome!

you better explain to me (or at least try) why this works, or I won't help any anons again.

I'm an untalented Matlab noob but I'll try.
function[value] = fibonacciValue(m)
%Note: m should be integers greater than or equal to 1.

value = [1 1];
i=2;
%starting values
while value(i) < m
%loop that is repeated until condition is met

value(i+1) = value(i)+value(i-1);
i= i+1;
%fibonacci series
end

if value(end) > m
value = value(1:end-1);
%we need the fibonacci element which is smaller than m
end
end

First of all, don't say "noob". second: can you tell me what the line value = value(1:end-1) does?
Overall not a bad explanation.

Maybe you'll help out another user some time

>First of all, don't say "noob"
lol why

before i answer that, what major are you OP?

I am not OP. But I am a math major.

end-1 is the second to the last element of the series. we're cutting off the last element it is larger than m and obtain the series which is asked for.

good for you. using noob makes me think you're a highschooler, and im not helping out any highschoolers

economics. why?

sounds good.

guess that means this thread is dead unless some one else has a matlab question i might answer

>econ
ugh.
i just was hoping i wasnt helping an engineering major

why is that? and is that you on the picture?

I'm a physicsfag and I don't really get the meme about engineers here. Got a few friends doing electrical and compuer eng and they're cool dudes.

>for loop

lel

function fib = fibonacciValue(m)
i=1:m;
phi=(sqrt(5)+1)/2;
return fib = round(phi.^i ./ sqrt(5));