Tuesday, October 03, 2006

just a intro

well, this is the 1st time i blog about what happened around me.technically this is the 2nd time.the 1st one as i saw in the archives was april 2005.hahaha...i'm tried to mess around that time.but now , its more about serious stuff maybe some main2 stuff la.donno what really i suppose to write..before i'm writing this my head was bombard with load of ideas but suddently those ideas seem to vanish, or perhaps hiding some where between the neuron

Friday, April 15, 2005

matlab hampeh

%%%%%In this file, it will extract values of from the original file
which
%%%%%is acs107_coursework2. From these values it will then input new
%%%%%fields into the output. It will also find the best straight line
and
%%%%%the best quadratic from the selected value of x and y (selected
from
%%%%%choice_of_4) and plot it in figure 1.

function task1 = coa04kik_cw2_task1(input)

%%%Extract the variables
task_1=input{1};
set_of_data=task_1(1).choice_of_4;
task1=task_1(set_of_data);

figure(1);clf reset;
for numb=1:4;
xvalues=task1(numb).xvalues;
yvalues=task1(numb).yvalues;

%%%%insert the additional fields
task1(numb).linecoef=polyfit(xvalues,yvalues,1);
task1(numb).quadcoef=polyfit(xvalues,yvalues,2);
task1(numb).yline=polyval(task1(numb).linecoef,xvalues);
task1(numb).yquad=polyval(task1(numb).quadcoef,xvalues);

%%%%Plotting the graphs.
subplot(2,2,numb);

plot(xvalues,yvalues,'b',xvalues,task1(numb).yline,'y',xvalues,task1(numb).yquad,'r');
legend('Original graph','Best line','Best quadratic');
function_name=task1(numb).functionname;
title(function_name);
xlabel('value of x');
ylabel('value of y');

end