Commit 02b36d57 authored by JEYASOORYA S's avatar JEYASOORYA S

Commited lab1_inlab

parents
#function whose root is to be found
function y = f(x)
#reading from the input file
A = load('input_inlab_task_A1.txt');
y = sin(x)-A(1,1)*sin(x/3)*cos(x)-A(1,2)*sin(x/3)*sin(x);
endfunction
#solving f(x) = 0
[p, info] = fzero("f",[0.00001 1.67]);
#writing into output file
fid = fopen ("output_inlab_task_01.txt","w") ;
fprintf(fid, "%f", p);
fclose(fid);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment