Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs251_group20
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AGRAWAL KANAK RAJESHKUMAR
cs251_group20
Commits
610c48c2
Commit
610c48c2
authored
Aug 23, 2016
by
AGRAWAL KANAK RAJESHKUMAR
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding refraction.m file from inlab01 task A1
parent
77ec6e4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
refraction.m
refraction.m
+15
-0
No files found.
refraction.m
0 → 100644
View file @
610c48c2
x
=
linspace
(
0
,
pi
/
2
,
100
);
% x stores reflection angle(i)
function
y
=
f
(
x
)
% by Snells' Law, we could conclude that solution of this equation is the required answer
data
=
load
(
"input_inlab_task_A1.txt"
);
nx
=
data
(
1
);
ny
=
data
(
2
);
y
=
sin
(
x
)
-
(
nx
*
cos
(
x
)
+
ny
*
sin
(
x
))
.*
sin
(
x
/
3
);
endfunction
;
%plot(x,f(x));
%figure
fun
=
@
f
;
x0
=
[
0.0001
pi
/
2
];
z
=
fzero
(
fun
,
x0
);
% stores the root of f closest to x0 in z
out
=
fopen
(
"output inlab task 01.txt"
,
'w'
);
fdisp
(
out
,
z
);
% writes ans in output file
fclose
(
out
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment