Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

matlab-problem number 2 please An interesting characteristic of soil is the perc

ID: 2249158 • Letter: M

Question


matlab-problem number 2 please

An interesting characteristic of soil is the percentage of water it holds at wilting point and at fiel capacity. The vertical profile of 3 soil type's field capacity and wilting point has been measured i laboratory as follows. Soil A Depth Soil B Depth Soil C Depth Wilting Point/Field Capacity 10%/15% 17%/39% 18%/62% 14%/52% 17%/22% Wilting Point/Field Capacity |0 | 5 | 10 | 11 | 19 Wilting Point/Field Capacity | 7%/14% 10%/14% 15%/19% 18%/22% 19%/24% | 6%/14% 10 | 4 10%/19% 11%/20% 7 14 18 19 | 19 Problem 1 (15 points): Write code that is able to store the vertical profile of any soil type's wilting and field capacity in Matlab. Your code must be able to store any number of soil types and any nu of measurements on each vertical profile (i.e. note that Soil C has only three vertical profile measurements while the others have 5 vertical profile measurements). You can assume that all so types will have points at 0 cm and 19 cmm Problem 2 (25 points): For any soil type, write code that can linearly interpolate the soil depth pro a profile of arbitrary depths. For example, the code should be able to transform the Soil A profile t profile with points at 0, 4, and 19 cm.

Explanation / Answer

function [iterfin] = multisvm( T,C,test ) %Inputs: T=Training Matrix, C=Group, test=Testing matrix %Outputs: iterfin=Resultant class iterind=size(test,1); iterfin=[]; Cb=C; Tb=T; for tempind=1:iterind tst=test(tempind,:); C=Cb; T=Tb; u=unique(C); N=length(u); c4=[]; c3=[]; j=1; k=1; if(N>2) itr=1; classes=0; cond=max(C)-min(C); while((classes~=1)&&(itr1 && cond>0) %This while loop is the multiclass SVM Trick c1=(C==u(itr)); newClass=c1; %svmStruct = svmtrain(T,newClass,'kernel_function','rbf'); % I am using rbf kernel function, you must change it also svmStruct = svmtrain(T,newClass); classes = svmclassify(svmStruct,tst); % This is the loop for Reduction of Training Set for i=1:size(newClass,2) if newClass(1,i)==0; c3(k,:)=T(i,:); k=k+1; end end T=c3; c3=[]; k=1; % This is the loop for reduction of group for i=1:size(newClass,2) if newClass(1,i)==0; c4(1,j)=C(1,i); j=j+1; end end C=c4; c4=[]; j=1; cond=max(C)-min(C); % Condition for avoiding group %to contain similar type of values %and the reduce them to process % This condition can select the particular value of iteration % base on classes if classes~=1 itr=itr+1; end end end valt=Cb==u(itr); % This logic is used to allow classification val=Cb(valt==1); % of multiple rows testing matrix val=unique(val); itrfin(tempind,:)=val; end end