Message from @ThisIsChris
Discord ID: 410212055250108437
@Deleted User Professor Leonard on YouTube has great videos for calc concepts. Also feel free to post pictures of problems if you want to.
this Professor Leonard guy is swole af
Does anyone here know Matlab? I’m taking a Matlab class and am super confused
@Sam Southern - TN I know *some* Matlab, what's up?
Driving rn, I’ll send what I’m working on in like 10. It’s basic (apparently lol), but I am not good at the cyber
Gen Z not being good at cyber hahah not living up to my gen I know
@Sam Southern - TN sounds good, post it when you can
1. Write a function (I'm calling it v) that takes in two scalars (a and b) spits out a vector (v) that is a row vector of the length b with the terms being the first a powers of b
So I tried to do someting like this:
function v = hw1_problem5(a,b)
b = length(v);
v = a.^b;
end
so that the function length would track with b and the vector would be that length
and the vector itself would use vector exponent rule of .^ to raise each to the correct power
but it's only giving me the first output instead of all of the outputs
for example, when I input hw1_problem5(2,3), it should output a row vector containing the first 3 powers of 2
so [2 4 8]
but it only gives [2]
so it's not accepting my length argument somehow
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
shit is so confusing to me
@ThisIsChris let me know if that doesn't make sense
if any other <@&387091385075105804> know how to matlab, I would greatly appreciate the help!
how do I set the length of the vector to b?
@Sam Southern - TN so first I would make a vector of 1..b, I'll call it powers, s
so
`powers = 1:b`
then
`v = a.^b`
now it's giving me the last one instead of the first one as the output
so [8]
instead of [2]
but not [2 4 8]
hmm I see, I'm at work now will have to check this out in a little while (unless someone else steps in 🙂 )
thanks for trying though, I do appreciate it
@Sam Southern - TN this works
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
that, and making the vector 1...b is `1:b`
@ThisIsChris thank you, that works!
just got back from work, happy to see this finally work hahah
@Sam Southern - TN You're weclome! 😄
Whoever recommended Professor Leonard. Probably the best videos I've found for this. Much appreciated
@Deleted User that was @JC17-OR