Message from Sam Southern - TN in MacGuyver - Skills & Academics #homework-help

2018-02-05 22:46:34 UTC  

so that the function length would track with b and the vector would be that length

2018-02-05 22:46:54 UTC  

and the vector itself would use vector exponent rule of .^ to raise each to the correct power

2018-02-05 22:47:07 UTC  

but it's only giving me the first output instead of all of the outputs

2018-02-05 22:47:57 UTC  

for example, when I input hw1_problem5(2,3), it should output a row vector containing the first 3 powers of 2

2018-02-05 22:48:04 UTC  

so [2 4 8]

2018-02-05 22:48:24 UTC  

but it only gives [2]

2018-02-05 22:48:34 UTC  

so it's not accepting my length argument somehow

2018-02-05 22:51:23 UTC  

there's another one after that that involves zeroing out part of an array in certain locations, but I'll take any help i can get

2018-02-05 22:51:27 UTC  

shit is so confusing to me

2018-02-05 22:53:44 UTC  

@ThisIsChris let me know if that doesn't make sense

2018-02-05 23:09:01 UTC  

if any other <@&387091385075105804> know how to matlab, I would greatly appreciate the help!

2018-02-05 23:16:15 UTC  

@Sam Southern - TN the second line, `b = length(v);` is changing the value of b

2018-02-05 23:16:33 UTC  

how do I set the length of the vector to b?

2018-02-05 23:18:20 UTC  

@Sam Southern - TN so first I would make a vector of 1..b, I'll call it powers, s

2018-02-05 23:18:32 UTC  

`powers = 1:b`

2018-02-05 23:18:38 UTC  


2018-02-05 23:18:50 UTC  

`v = a.^b`

2018-02-05 23:19:57 UTC  

now it's giving me the last one instead of the first one as the output

2018-02-05 23:20:01 UTC  

so [8]

2018-02-05 23:20:05 UTC  

instead of [2]

2018-02-05 23:20:10 UTC  

but not [2 4 8]

2018-02-05 23:21:57 UTC  

hmm I see, I'm at work now will have to check this out in a little while (unless someone else steps in πŸ™‚ )

2018-02-05 23:22:39 UTC  

thanks for trying though, I do appreciate it

2018-02-06 00:31:20 UTC  
2018-02-06 00:31:27 UTC

2018-02-06 00:32:02 UTC  

The trick I had to remember was that a function that accepts scaler, if you plug in a vector, will return you a vector with the function applied to each entry

2018-02-06 00:32:34 UTC  

that, and making the vector 1...b is `1:b`

2018-02-06 02:25:10 UTC  

@ThisIsChris thank you, that works!

2018-02-06 02:25:38 UTC  

just got back from work, happy to see this finally work hahah

2018-02-06 02:26:04 UTC  

@Sam Southern - TN You're weclome! πŸ˜„

2018-02-07 03:58:21 UTC  

Whoever recommended Professor Leonard. Probably the best videos I've found for this. Much appreciated

2018-02-07 04:32:50 UTC  
2018-02-07 05:10:43 UTC  

@Deleted User My pleasure

2018-02-14 03:09:04 UTC  

I was wondering if someone could help me with a problem for my financial mathematics class?

2018-02-14 03:09:35 UTC  


2018-02-14 03:32:28 UTC  

@Tycho Brahe @Zyzz you guys too may have some insight for @Deleted User ?

2018-02-14 03:34:38 UTC  

I'll go ahead and post a screenshot of the problem so people could see if they would be able to help.

2018-02-14 03:34:57 UTC  

@Deleted User What's the question? If you drop it here then when someone who can help comes on they can work on it

2018-02-14 03:35:13 UTC  

yeah perfect

2018-02-14 03:35:22 UTC

2018-02-14 03:38:56 UTC  

Here are my notes. The example is supposed to align with how to do the problem, I just can’t seem to get the right answer.