Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs251_group33
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
VINAYAK K
cs251_group33
Commits
80d54442
Commit
80d54442
authored
Aug 23, 2016
by
VINAYAK K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lab01-inlabA
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
lab01/inlab/lab01_group33_final/readme.txt
lab01/inlab/lab01_group33_final/readme.txt
+18
-0
lab01/inlab/lab01_group33_final/refraction.m
lab01/inlab/lab01_group33_final/refraction.m
+36
-0
No files found.
lab01/inlab/lab01_group33_final/readme.txt
0 → 100644
View file @
80d54442
Group 33 : Lab01_inlab
Group Members:
(Vinayak K, 150050098), (Shriram S B, 150050099), (Anubhaw Kuntal Xess, 150050100)
Vinayak K - 100%
Shriram S B - 100%
Anubhaw Kuntal Xess - 100%
I pledge on my honour that I have not given or received any unauthorized assistance on this assignment or any previous task.
Reflection essay:
- octave function declaration, global variables
- tried fsolve()
- found that fzero() better for single variable
- File I/O in octave
Citations: Gnu octave Documentation
\ No newline at end of file
lab01/inlab/lab01_group33_final/refraction.m
0 → 100644
View file @
80d54442
% nx, ny global variable to hold tensor values
global
nx
;
global
ny
;
% reading nx, ny from input file
input_ptr
=
fopen
(
"input_inlab_task_A1.txt"
,
"r"
);
[
nx
,
ny
,
count
,
errmsg
]
=
fscanf
(
input_ptr
,
"%lf %lf"
,
"C"
);
fclose
(
input_ptr
);
% function which returns value of the expression for some incident angle x(rad)
function
ret_val
=
f
(
x
)
global
nx
;
global
ny
;
ret_val
=
(
sin
(
x
)
/
sin
(
x
/
3
)
-
nx
*
cos
(
x
)
-
ny
*
sin
(
x
)
);
endfunction
% finding interval in which function changes sign
a
=
1e-10
;
dx
=
0.1
+
1e-10
;
b
=
dx
;
while
(
f
(
a
)
*
f
(
b
)
>=
0
)
a
+=
dx
;
b
+=
dx
;
endwhile
% the interval in which expression has a root
bracket
=
[
a
;
b
];
% fzero to find value at which expression is zero
[
x
,
fval
,
info
,
output
]
=
fzero
(
"f"
,
bracket
);
output_ptr
=
fopen
(
"output_inlab_task_01.txt"
,
"w"
);
fprintf
(
output_ptr
,
"%f"
,
x
);
fclose
(
output_ptr
);
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