W1Q1: Raise a number to a power % Option 1 - Hands down the simplest v=2.^[0:8]; % Option 2 - Too much hand-typing going on a= [0 1 2 3 4 5 6 7 8]; v=2.^a; % Option 3 - Better than 2, consider whether you'll use v1 again v1= 0:8; v=2.^v1; % Option 4 - Hard to generalize to other powers v=pow2(0:8) % Option 5 - Overkill on the linspace v=linspace(2,2,9).^linspace(0,8,9); % Option 6 - Also slight overkill on getting a bunch of "2"s v1=ones(1,9)*2; v=v1.^(0:8); % Option 7 - Not taking advantage of vectorization v=zeros(1,9); powers=0:1:8; for ii=1:1:9; v(1,ii)=2.^powers(ii); end % Option 8 - Waaaay too much error-prone typing! v=[2^0 2^1 2^2 2^3 2^4 2^5 2^6 2^7 2^8] % Option 9 - Sure, but the ^ does beat the "power" v=[power(2,0:1:8)]; W1Q2: Plot a wind direction vector Draw yourself a diagram, and remember how to take a cosine and a sine! Many people got this wrong on the mathematics, though not on the coding. My solution would have been adeg=60; y=cos(adeg*pi/180); x=sin(adeg*pi/180); Some people used "cosd" and "sind", which you can feed degrees instead of radians. That's fine, a matter of choice, I suppose. Though I like radians best. Here's an alternative to switch cosine and sine, not particularly simpler adeg=60; y=sin((90-adeg)*pi/180); x=cos((90-adeg)*pi/180); And here's a very contorted way to do the same thing: % angle of clockwise displacement from vertical adeg = 60; % starting point, vertical axis vertaxisd = 90; % calculate vertical component of wind vector from origin y = sind(vertaxisd - adeg); % calculate horizontal component of wind vector from origin x = cosd(vertaxisd - adeg); % This solution is wrong and not using any coding - adeg doesn't get used adeg=60; y=sqrt(3); x=1; % Same situation here adeg=60; y=sind(120); x=cosd(120); % Even more explicit here, and still wrong! If you are not using % "adeg" as a variable, you are not coding adeg=60; y=5.77; x=10; % Why the absolute values? And mixing degrees and radians adeg=60; y=abs(sin(90-adeg)); x=abs(cos(90-adeg)); W1Q3: Element-multiply two vectors Simple, and quick: % Do not change the variable names below a=[1 2 3 4 5]; b=[6 7 8 9 0]; % Write your answer here below c=a.*b; % Wrong. The .* is not the "dot" product, which is the sum of the former c=dot(a,b); % Right. Rather, the "times" is what .* does c=times(a,b); W1Q4: Make a matrix of a defined size Simple, quick, elegant: m=4; n=7; A=nan(m,n); If you like typing capitals, also good: A=NaN(m,n); Overkill with brackets and commas, but still good A=NaN([4,7]) Also good A=NaN([4 7]) Somewhat too complicated, but explicit, and right A(1:m,1:n) = NaN; Complicated! But the last line does not use m or n! m=4; n=7; x=NaN; a=[x x x x x x x] A=repelem(a,4,7); % Again, too explicit! You are not using m or n. Also, the dimensions don't work. m=2; n=3; A= [NaN NaN ; NaN NaN NaN]; W1Q5: Element-divide two matrices Most everyone gets what I intended, some variation on: cv=round(abs(((a./b-1)*100)); mc=mean(c); Those of you using RDIVIDE will get tired of typing. But good find!