% I am finding that fewer than all of you attempt the question! Don't let it slip, they are meant to be helpful rather than hard. % Please don't treat the "submit" button as a "I will try this" button. Execute your answers in your own command line, see if they work! Future editions will restrict the number of submissions you can make. W5Q1: Find a percentile % My solution: prc=[37 86 95]; vp=prctile([1:100].^linspace(0,1,length(v)),prc); % Take a look at your own solution. If it passed, it must have been a slight variation on mine. If it failed, I've found your mistakes easily, and so should you! W5Q2: Judge a correlation % My solution x1=[ 1 5 -6 8 9 2 0 -2 18 29 54]; x2=[-1 4 -6 4 12 -2 3 -2 33 19 47]; alfa=0.95; [r,p]=corr(x1(:),x2(:)); t=p<(1-alfa); % Many of you seem to not have read the "help" on "corr", you would see that if it is to returns a single coefficient and a single significance level, you have to give it two COLUMN VECTORS as input. I make sure that my vectors are columns by the use of (:). The use of the TRANSPOSE is not really recommended, although it works. Trouble with transpose is that it is a relative operatore, turning rows into columns, and columns into rows. The (:) turns anything always into colums. W5Q3: Perform date conversions % My solution bd1=721206; bds1=datestr(bd1,'dd-mm-yyyy'); bds2='Dec-30-1975'; bd2=datenum(bds2,'mmm-dd-yyyy'); yearswiser=round([bd2-bd1]/365); monthswiser=round([bd2-bd1]/365*12); dayswiser=round([bd2-bd1]); % Many of you got this wrong, most of you by not reading the question carefully enough. Read it again, see what I mean. Some of you tried using DATETIME, which I was hoping you'd avoid, given that it is a very high-level function, which comes with a lot of baggage. % In retrospect, I should have written: assume that a year has 365 days and 12 months. I wasn't asking exact "calendar" dates, just units of (average) years, (average) months, and days. W5Q4: Generate a sine wave % I find it unlikely that you are trying your solutions on your own command line!! Many of those don't run, and give you very specific error messages that would help you fix your submissions. % My solution h=0:1:100; A=[1 2 3]; P=[6 12 24]; m=13.5; v=m+A(:)'*sin(2*pi*h./P(:)); % Here is an explicit alternative v=m+A(1)*sin(2*pi/P(1)*h)+... A(2)*sin(2*pi/P(2)*h)+... A(3)*sin(2*pi/P(3)*h); % Note that the mean only goes in here once! W5Q5: Fourier transform % My solution xsint=1; h=1:xsint:6897; % Take a good look at this: v=[3 2 1]*sin(2*pi*h./[19 ; 33 ; 11]); % READ the above line to SEE that the answer to the question MUST be 19! nfft=length(h); selekt=[1:nfft/2+1]; fax=[selekt-1]/xsint/nfft; vf=abs(fft(v,nfft)).^2; vf=vf(selekt); % Notice the syntax of MAX [~,faxi]=max(vf); % Check that this number is indeed 19! mper=1/fax(faxi);