[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Using matlab... I need to write a code that can calculate the

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 1

Using matlab...
I need to write a code that can calculate the Indian king chess rise riddle and display it in an array as the chess board.

My problem is i can't make an array thats (1,0) cause that's wrong, but i need to be able to get the previous square to get calculated or it all won't work.

How can i get an array to calculate the previous numbers with the first number included without it being x(1,0) at the start?

X=zeros(8,8);
X(1,1) = 1;
For i = 1 : 8
For j = 1 : 8
X(i,j+1) = x(i,j-1) + x(i,j-1);
End
X(i,1) = x(i-1,5);
End
Disp(x);
>>
It's a bad idea to let others do your homework, especially in programming, because this way you won't learn it ever.
But as a tip, have you thought of using an if-statement for that special case?
>>
>>52233835
There was a way that i can't find that we use j-1+1 to make it happen, its what i want.
But i guess this will work too.
Just removed the -1 and made the j+1 is the one to get changed.

X=zeros(8,8);
X(1,1) = 1;
For i = 1 : 8
For j = 1 : 8
X(i,j+1) = x(i,j) + x(i,j);
End
X(i,1) = x(i-1,5);
End
Disp(x);
>>
>>52233998
I'll take that back it doesn't work.
Now the problem is after cause it'll be x(1,9) which is not available and isn't needed.

I'm a civil engineer
We have to take this course but its not that much use to us.
But i can't find a way of making this work and the google isn't helping.
>>
>>52233765
Dude, /g/ is illiterate. De facto consumer electronics.
>>52234075
I'm EE and had like 4x2 hours of it and only ever copied stuff from others. It's useless.
>>
MATLAB pro here. Can you formulate your problem in a way that I can understand? I am not familiar with the Indian King Chess riddle and I don't feel like educating myself at this very moment.
>>
>>52235722
Anyway, here's the code:

X = reshape(1:64, [8 8])';
foo = @(t)(power(2,t));
res = foo(X);
disp(res)


First line constructs a 8x8 matrix with the numbers 1-64.

Second line creates a function that basically does 2^x, where x is the input.

Third line applies the function to the matrix.

Voila!
>>
>>52235983
Much more readable than >>52233998 and >>52233765
What do you use MATLAB for and for how long?
Have you used octave or other alternatives around Python and Julia? Any opinion on them?
>>
>>52236178
I've been using exclusively Julia for about 2 years now. Octave is complete shit, it's good only for porting very exotic and unique libraries/toolboxes. Python is pretty shit too. Seriously, either use Julia or sell your soul to MathWorks. That being said, if you are considering doing serious work in academia or in the industry, then you will almost surely have to work with MATLAB, which is a pity. If you have the opportunity, talk with your manager for potential switch to Julia. Remind them that:
>it's well-documented
>completely free
>MIT license
>good PR
>>
>>52236259
If you don't mind me asking more questions..

What kind of work are you doing?
Industry or academia? If industry, what qualifications would you say are best to get into your kind of work or similar work around (scientific) computation? Any other recommendations?
What environment do you use? (OS, IDE/REPL?)

I am doing my bachelor in math and that's the kind of work I want to do when I complete my master.
>>
>>52235722
It says that the indian king was playing chess with some peasant and the peasant won, so the indian king told him to ask for anything.

He told him : if the first square had 1 rise pieces the second had 2 rise pieces and third square had 4... (prev num + prev num = new num) i want the amount of rise that will be in the last square.

He sent him to jail after that, for making fun of him asking for a couple of rise pieces. (he thought)

Turns out the amount of rise that was in the last square equals the amount of rise all India produces for 4 year.
>>
>>52236928
I am working something completely unrelated now, but 2 years ago I worked briefly for one of the top 10 largest companies (revenue wise) in the world, doing mathematical modelling of their systems (I don't want to reveal more). Good mathematicians are always sought, the 300k starting meme is not THAT much exaggerated. It's hard to tell about qualifications, as good positions like this usually look for well-rounded individuals, but obviously you need experience with the tools of the trade, pretty much just MATLAB. There are some certificates that are supposed to help you, I didn't have any of them. Then again, I did a lot, and I mean A LOT of MATLAB in school and I was recruited right after graduation. So I could easily demonstrate my ability. That's what you've got to show -- that you capable of understanding real world problems and providing actual solutions, not doing fizzbuzz and whatnot.

We used almost exclusively Windows with MATLAB enterprise license, but there were some stations with RedHat Enterprise running (and MATLAB environment, of course).

If you are Masters student, great. Focus your work on software modelling and then you'll have stuff to show to prospective employers. The money could be really great and it's really a different world if you get in the right position.
>>
>>52237222
Of yeah, forgot:

When I say MATLAB, I really mean MATLAB+Simulink+all the popular toolboxes
>>
>>52237256
Thanks a lot. I'll definitely do more in that area.
Thread posts: 14
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.