Commit e61d3d7b authored by BHARAT KHANDELWAL's avatar BHARAT KHANDELWAL

Lab1

parents
# Define Function:
function y = f (x)
# Read refractive indices from file
[a, b] = textread ("input_inlab_task_A1.txt", "%f %f");
# Calculate y
y = a * cos(x) + b * sin(x) + 4*(sin(x/3)^2) -3;
endfunction
# Comment: Solve System with guess as 1.01:
[x] = fsolve ("f", 1.01);
# Initiating file handle
fid = fopen ("output inlab task 01.txt", "w");
#Writing answer to file
fputs (fid, num2str(x));
fclose (fid);
\ No newline at end of file
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