plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | ruthvik92/Sessile-Droplet-Edge-Detection-master | derive_angle.m | .m | Sessile-Droplet-Edge-Detection-master/derive_angle.m | 1,535 | utf_8 | 6e7dead8b1be50fa63c6556e1ebcd271 | % Finds the x value of the point of intersection and the angle between the
% tangent of a 4th order polynomial, and a straight line.
% Inputs:
% f_lef: equation of a quartic function
% f_line: equation of a line
% I: an image file
% side_on: "string input" representing the side the angle is on
% boun... |
github | ruthvik92/Sessile-Droplet-Edge-Detection-master | poly_line.m | .m | Sessile-Droplet-Edge-Detection-master/poly_line.m | 2,581 | utf_8 | 31cb9842ce99542ad0fd2cc5daa415da | % function "poly_line" computes a 4th order polynomial fit across two sets of
% XY points, and one line fit across one set of linear points, and returns a
% two equations representing 4th order polynomial fits, an equation
% representing a line fit, and their respective f(x) values.
%
% Inputs:
% boundary_left
... |
github | lorisbaz/self-taught_localization-master | generate_figures.m | .m | self-taught_localization-master/generate_figures.m | 1,281 | utf_8 | 1e0acdb10477431a71ff3299c29fa3e7 | function generate_figures(figures_to_generate)
% list here the figures to generate (specifying the function file names)
if nargin < 1
figures_to_generate = { ...
'ILSVRC2012_1000_VAL_mean_recall', ...
'ILSVRC2012_1000_VAL_mean_precision', ...
'PASCAL2007_TRAINVAL_mean_recall', ...
'PASCAL20... |
github | lorisbaz/self-taught_localization-master | ILSVRC2012_200rnd_VAL_detection_AP_best_worst_categories.m | .m | self-taught_localization-master/utils_generate_figures_paper/ILSVRC2012_200rnd_VAL_detection_AP_best_worst_categories.m | 3,417 | utf_8 | c7a20ddde155f8a667733f42092aeb50 | function ILSVRC2012_200rnd_VAL_detection_AP_best_worst_categories()
config;
% ----------- Table top-C, bottom-C classes ----------- %
[~, GTdet.idx_sort] = sort(GTdet.average_precision, 'descend');
[~, OBFSgt.idx_sort] = sort(OBFSgt.average_precision, 'descend');
[~, SS.idx_sort] = sort(SS.average_precision, 'descend... |
github | lorisbaz/self-taught_localization-master | pdftops.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/pdftops.m | 3,188 | utf_8 | eb7ee38e8e5d4b47aab7a7aa9d2208c4 | function varargout = pdftops(cmd)
%PDFTOPS Calls a local pdftops executable with the input command
%
% Example:
% [status result] = pdftops(cmd)
%
% Attempts to locate a pdftops executable, finally asking the user to
% specify the directory pdftops was installed into. The resulting path is
% stored for futur... |
github | lorisbaz/self-taught_localization-master | isolate_axes.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/isolate_axes.m | 3,794 | utf_8 | b104d66dd4d36f35d275c4ef3d2f41cd | %ISOLATE_AXES Isolate the specified axes in a figure on their own
%
% Examples:
% fh = isolate_axes(ah)
% fh = isolate_axes(ah, vis)
%
% This function will create a new figure containing the axes/uipanels
% specified, and also their associated legends and colorbars. The objects
% specified must all be in th... |
github | lorisbaz/self-taught_localization-master | pdf2eps.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/pdf2eps.m | 1,525 | utf_8 | 9b46432b206f5e1d2f60051a8fb16247 | %PDF2EPS Convert a pdf file to eps format using pdftops
%
% Examples:
% pdf2eps source dest
%
% This function converts a pdf file to eps format.
%
% This function requires that you have pdftops, from the Xpdf suite of
% functions, installed on your system. This can be downloaded from:
% http://www.foolabs.c... |
github | lorisbaz/self-taught_localization-master | print2array.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/print2array.m | 6,474 | utf_8 | 4ead930267fe61c9b2a87139ee559dc8 | %PRINT2ARRAY Exports a figure to an image array
%
% Examples:
% A = print2array
% A = print2array(figure_handle)
% A = print2array(figure_handle, resolution)
% A = print2array(figure_handle, resolution, renderer)
% [A bcol] = print2array(...)
%
% This function outputs a bitmap image of the given fig... |
github | lorisbaz/self-taught_localization-master | eps2pdf.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/eps2pdf.m | 5,149 | utf_8 | a76c49a222381133a3c337333bf6a983 | %EPS2PDF Convert an eps file to pdf format using ghostscript
%
% Examples:
% eps2pdf source dest
% eps2pdf(source, dest, crop)
% eps2pdf(source, dest, crop, append)
% eps2pdf(source, dest, crop, append, gray)
% eps2pdf(source, dest, crop, append, gray, quality)
%
% This function converts an eps file... |
github | lorisbaz/self-taught_localization-master | copyfig.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/copyfig.m | 846 | utf_8 | 8f479727f76b878a077b76ca7afed48e | %COPYFIG Create a copy of a figure, without changing the figure
%
% Examples:
% fh_new = copyfig(fh_old)
%
% This function will create a copy of a figure, but not change the figure,
% as copyobj sometimes does, e.g. by changing legends.
%
% IN:
% fh_old - The handle of the figure to be copied. Default: gc... |
github | lorisbaz/self-taught_localization-master | user_string.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/user_string.m | 2,462 | utf_8 | dd1a7fa5b4f2be6320fc2538737a2f3e | %USER_STRING Get/set a user specific string
%
% Examples:
% string = user_string(string_name)
% saved = user_string(string_name, new_string)
%
% Function to get and set a string in a system or user specific file. This
% enables, for example, system specific paths to binaries to be saved.
%
% IN:
% string_name - ... |
github | lorisbaz/self-taught_localization-master | export_fig.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/export_fig.m | 30,730 | utf_8 | 376baa9aac77137ddab15546dd1d11b6 | %EXPORT_FIG Exports figures suitable for publication
%
% Examples:
% im = export_fig
% [im alpha] = export_fig
% export_fig filename
% export_fig filename -format1 -format2
% export_fig ... -nocrop
% export_fig ... -transparent
% export_fig ... -native
% export_fig ... -m<val>
% export_fig... |
github | lorisbaz/self-taught_localization-master | ghostscript.m | .m | self-taught_localization-master/utils_generate_figures_paper/export_fig/ghostscript.m | 5,169 | utf_8 | 6c4ddcf9e83cbc0d50d5ecd1921a1350 | %GHOSTSCRIPT Calls a local GhostScript executable with the input command
%
% Example:
% [status result] = ghostscript(cmd)
%
% Attempts to locate a ghostscript executable, finally asking the user to
% specify the directory ghostcript was installed into. The resulting path
% is stored for future reference.
% ... |
github | biolab-unige/wueLib-master | MTM_append_event.m | .m | wueLib-master/matlab/tools/MTM_append_event.m | 3,973 | utf_8 | 98804ed09354fe2f418d60de67ef1287 | function outeegfilename = MTM_append_event(varargin)
%BN_TENSSYNCH synchronize multiple files in the same vhdr/eeg file
% FLAG = BN_TENSSYNCH(VARARGIN) I'll edit it when it will be ready
%
% Edited 2014-09-22 by Gabriele Arnulfo <gabriele.arnulfo@gmail.com>
%
%%% DEFINE SUPPORTED FILE EXTENSIONS %%%%
p = inputParser;... |
github | biolab-unige/wueLib-master | MTM_append_eeg.m | .m | wueLib-master/matlab/tools/MTM_append_eeg.m | 1,916 | utf_8 | 7125a3187f7eedc0de77843c8549bc2f | function eegFname = MTM_append_eeg(varargin)
%BN_TENSSYNCH synchronize multiple files in the same vhdr/eeg file
% FLAG = BN_TENSSYNCH(VARARGIN) I'll edit it when it will be ready
%
% Edited 2014-09-22 by Gabriele Arnulfo <gabriele.arnulfo@gmail.com>
%
%%% DEFINE SUPPORTED FILE EXTENSIONS %%%%
p = inputParser;
p.addRe... |
github | biolab-unige/wueLib-master | popolate_brainstorm_db.m | .m | wueLib-master/matlab/tools/popolate_brainstorm_db.m | 12,945 | utf_8 | 7c9a0554c48c8670d9121c03698dc395 | function popolate_brainstorm_db()
subjects = {'wue02','wue05','wue09','wue10','wue11'};
% subjects = {'wue02'};
cond = {'D1RANLEFT','D1RANRIGHT','D1ROTRIGHT','D2RANLEFT','D2RANRIGHT','D2ROTRIGHT'};
% cond = {'D1RANLEFT'};
ecg_channel = {'F4','F4','F4','F4','FFC3h'};
for iSub = 1:length(subjects)
[sSubjec... |
github | biolab-unige/wueLib-master | wlb_popolate_brainstorm_db.m | .m | wueLib-master/matlab/tools/wlb_popolate_brainstorm_db.m | 13,277 | utf_8 | 0891232a2497c2a6a4edddb468ef2a8b | function wlb_popolate_brainstorm_db
root_directory = 'C:\Users\andrea83\Documents\Projects_data\TMS\FollowUp';
list_Dir = dir(fullfile(root_directory,'w*'));
for i=1:ength(list_Dir)
list_file = dir(fullfile(root_directory,list_Dir(i).name,'*.eeg'));
for j =1:length(list_file)
li... |
github | biolab-unige/wueLib-master | wlb_convertActivaPCtoEEG.m | .m | wueLib-master/matlab/tools/wlb_convertActivaPCtoEEG.m | 2,663 | utf_8 | 8a05bf06a6ab0a85a0735d9d985fa9ad | function wlb_convertActivaPCtoEEG(folder,logFid,pattern)
%WLB_CONVERTACTIVAPCTOEEG Append to a single BrainAmp file all the PC+s data
% WLB_CONVERTACTIVAPCTOEEG(FOLDER)
%
% fprintf(logFid,'Reading in %s\n',folder);
fprintf('Reading in %s\n',folder);
fnames = dir(fullfile(folder,'*xml'));
fnames = filterFname... |
github | biolab-unige/wueLib-master | wlb_convertPLXtoEEG.m | .m | wueLib-master/matlab/tools/wlb_convertPLXtoEEG.m | 1,304 | utf_8 | e29a41b0aed8665166b4e807af68faea | function varargout = bn_convertPLXtoEEG(filename)
% bn_convertPLXtoEEG
% Edited 2015-04-01 by Gabriele Arnulfo <gabriele.arnulfo@gmail.com>
dataStruct = readPLXFileC( filename,'all');
channelNames = [{dataStruct.ContinuousChannels.Name}];
% Extract LFPs channels
lfpsChannelsMask = ~cellfun(@isempty,regexp(channelN... |
github | biolab-unige/wueLib-master | uninstall_emd.m | .m | wueLib-master/matlab/lib/package_emd/uninstall_emd.m | 2,128 | utf_8 | f1f4135f0d97101408694ab4f544d561 | % UNINSTALL_EMD.M uninstall the EMD package
% reverts the modifications made by INSTALL_EMD:
% removes the following locations from Matlab's path:
% <EMD_BASEDIR>
% <EMD_BASEDIR>/utils
% <EMD_BASEDIR>/examples/NSIP2003
% <EMD_BASEDIR>/examples/SPL2007
%
% where <EMD_BASEDIR> is the directory containing uninstall_emd.m
... |
github | biolab-unige/wueLib-master | install_emd.m | .m | wueLib-master/matlab/lib/package_emd/install_emd.m | 1,562 | utf_8 | edba7a4d545fe9776097f92bd1ed273e | %INSTALL_EMD.M install the EMD package
% add the following locations to Matlab's path:
% <EMD_BASEDIR>
% <EMD_BASEDIR>/emd
% <EMD_BASEDIR>/utils
% <EMD_BASEDIR>/examples/NSIP2003
% <EMD_BASEDIR>/examples/SPL2007
%
% where <EMD_BASEDIR> is the directory containing install_emd.m
%
% and compiles the C codes
%
% IMPORTANT... |
github | biolab-unige/wueLib-master | cemd_visu.m | .m | wueLib-master/matlab/lib/package_emd/utils/cemd_visu.m | 2,823 | utf_8 | 5c2f5edbd41b0b0d83980d462bebf66c | %CEMD_VISU visualization of bivariate/complex EMD
%
% inputs : - x : complex analyzed signal
% - t : time instants
% - imf : set of complex IMFs
% - i (optional) : figure number for display
%
%
% The slider on the right hand side of the figure controls the direction on
% which the co... |
github | biolab-unige/wueLib-master | disp_hhs.m | .m | wueLib-master/matlab/lib/package_emd/utils/disp_hhs.m | 1,573 | utf_8 | 2399fc6ab102d8203e3cda3fdfaf9d57 | %DISP_HHS display Hilbert-Huang spectrum
%
% DISP_HHS(im,t,inf)
% displays in a new figure the spectrum contained in matrix "im"
% (amplitudes in dB).
%
% inputs: - im: image matrix (e.g., output of "toimage")
% - t (optional): time instants (e.g., output of "toimage")
% - inf (optional): -dynamic ... |
github | biolab-unige/wueLib-master | plotc.m | .m | wueLib-master/matlab/lib/package_emd/utils/plotc.m | 3,243 | utf_8 | 9e878242623f66dbe1f061cca4f876b9 | %PLOTC plots a complex signal in 2D projection with variable projection angle.
%The angle can be modified at any time using the slider:
% slider at bottom: angle=0 the projection is the real part of the signal
% slider at 1/4: angle=pi/2 the projection is the imaginary part of the signal
% slider at top: angle=2pi sam... |
github | biolab-unige/wueLib-master | findtag.m | .m | wueLib-master/matlab/lib/package_emd/utils/findtag.m | 1,044 | utf_8 | 7454c7afdd89ce124034fa98264cb74e | %FINDTAG locate objects with specific tag
%
% FINDTAG(STR)
% Locate objects with specific tag STR
%
% FINDTAG(OBJECT_HANDLES,STR)
% Restricts the search to objects listed in objhandles and their descendants.
%
% FINDTAG(...,'-depth',d)
% The depth argument d controls how many levels under the handles in objhandles
%... |
github | biolab-unige/wueLib-master | emd_visu.m | .m | wueLib-master/matlab/lib/package_emd/utils/emd_visu.m | 3,216 | utf_8 | b14b325a26ce79c2d4107444497d6eee | %EMD_VISU visualization of EMD and partial reconstructions (fine to coarse & coarse to fine)
%
% inputs : - x : analyzed signal, if x is complex cemd_visu is called
% - t : time instants
% - imf : output of emd.m
% - i (optional) : figure number for display
%
% outputs : - f2c : fin... |
github | biolab-unige/wueLib-master | smoothn.m | .m | wueLib-master/matlab/lib/package_emd/utils/smoothn.m | 16,207 | utf_8 | 6a4380e3b3dc8d43b0886e0c977d59a3 | function [z,s,exitflag,Wtot] = smoothn(varargin)
%SMOOTHN Robust spline smoothing for 1-D to N-D data.
% SMOOTHN provides a fast, automatized and robust discretized smoothing
% spline for data of any dimension.
%
% Z = SMOOTHN(Y) automatically smoothes the uniformly-sampled array Y. Y
% can be any N-D noisy ar... |
github | biolab-unige/wueLib-master | boundary_conditions_emd.m | .m | wueLib-master/matlab/lib/package_emd/utils/boundary_conditions_emd.m | 3,546 | utf_8 | bde5088d1c5d540f2f15221e7130a453 | %BOUNDARY_CONDITIONS_EMD extends an extrema set to limit edge effects on the interpolations
%
%
% [TMIN,TMAX,ZMIN,ZMAX] = BOUNDARY_CONDITIONS_EMD(INDMIN,INDMAX,T,X,Z,NBSYM)
%
% inputs:
% - INDMIN, INDMAX: indices of minima and maxima in the real signal X
% - T: sampling times
% - X: real signal in which INDMIN ... |
github | biolab-unige/wueLib-master | plot3c.m | .m | wueLib-master/matlab/lib/package_emd/utils/plot3c.m | 798 | utf_8 | 18cd6c9a1aa6a3a04e75a7a24b35a431 | %PLOT3C plots a complex signal in 3D
%
% use: same as plot
%
%
% See also
% plotc (another type of visualization of complex signals)
%
% G. Rilling, last modification 12.2006
% gabriel.rilling@ens-lyon.fr
function varargout = plot3c(varargin)
% if first arument is a handle to some axes object
if nargin >=2 && isscal... |
github | biolab-unige/wueLib-master | cemd_disp.m | .m | wueLib-master/matlab/lib/package_emd/utils/cemd_disp.m | 2,547 | utf_8 | bcfc94ab889ec17222f5ac9d56aeebdd | %CEMD_DISP displays complex envelope curves and the corresponding tube envelope
%
%
%CEMD_DISP(T,X,ENV,MODE)
%
% inputs:
% - T: time instants
% - X: analyzed signal (complex)
% - ENV: matrix returned by cenvelope.m Each line is an envelope curve
% - MODE: 'render' -> 3D rendering of the tube en... |
github | biolab-unige/wueLib-master | extr.m | .m | wueLib-master/matlab/lib/package_emd/utils/extr.m | 1,938 | utf_8 | b255b6a18f2f3ebfbd1655dfddc2017b | %EXTR finds extrema and zero-crossings
%
% [indmin, indmax, indzer] = EXTR(x,t)
%
% inputs : - x : analyzed signal
% - t (optional) : sampling times, default 1:length(x)
%
% outputs : - indmin = indices of minima
% - indmax = indices of maxima
% - indzer = indices of zero-crossings
%
% See... |
github | biolab-unige/wueLib-master | addtag.m | .m | wueLib-master/matlab/lib/package_emd/utils/addtag.m | 791 | utf_8 | 7753834d0f8132b47b2646f9a79bde33 | %ADDTAG add a tag to an object
%
% ADDTAG(OBJ_HANDLE,STR)
%
% Adds the tag STR to the object referrenced by OBJ_HANDLE
% When OBJ_HANDLE is an array of handles, STR is added to all corresponding
% objects.
%
% Rem: In order for this to work properly, the object's tag field must be a string
% containing keywords (or... |
github | biolab-unige/wueLib-master | dirstretch.m | .m | wueLib-master/matlab/lib/package_emd/utils/dirstretch.m | 1,248 | utf_8 | ac3b11257589d22ec8b3705e588d54a2 | %DIRSTRETCH variable directional stretching of a complex vector
%
% DIRSTRETCH(X,D) where X is a complex vector and D a complex scalar stretches X by abs(D) along the direction arg(D)
% if D is a vector the same size as X, then X(i) is stretched by abs(D(i)) along the direction arf(D(i))
% DIRSTRETCH(X,DIR,COEF) whe... |
github | biolab-unige/wueLib-master | hhspectrum.m | .m | wueLib-master/matlab/lib/package_emd/utils/hhspectrum.m | 1,462 | utf_8 | 1e494abb67ee7ff81d9c5cde7df11933 | %HHSPECTRUM compute Hilbert-Huang spectrum
%
% [A,f,tt] = HHSPECTRUM(x,t,l,aff) computes the Hilbert-Huang spectrum
%
% inputs:
% - x : matrix with one signal per row
% - t : time instants
% - l : estimation parameter for instfreq (integer >=1 (1:default))
% - aff : if 1, displays the computation evolut... |
github | biolab-unige/wueLib-master | hastag.m | .m | wueLib-master/matlab/lib/package_emd/utils/hastag.m | 659 | utf_8 | 98c2d59c6e9ddf7de584ddba67f6ec51 | %HASTAG tests if an object has a specific tag
%
% BOOL = HASTAG(OBJ_HANDLE,STR)
%
% Tests if the object corresponding to OBJ_HANDLE has the tag STR.
% When OBJ_HANDLE is an array of handles HASTAG returns a logical array of
% the same size.
%
% Rem: In order for this to work properly, the object's tag field must be ... |
github | biolab-unige/wueLib-master | rmtag.m | .m | wueLib-master/matlab/lib/package_emd/utils/rmtag.m | 820 | utf_8 | c8cca7ed559bb8d9f89e3f8e3b34fc72 | %RMTAG removes tag from object
%
% RMTAG(OBJ_HANDLE,STR)
%
% Removes the tag STR from the object referrenced by OBJ_HANDLE
% When OBJ_HANDLE is an array of handles, the tag is removed from all
% corresponding objects.
%
% Rem: In order for this to work properly, the object's tag field must be a string
% containing ... |
github | biolab-unige/wueLib-master | toimage.m | .m | wueLib-master/matlab/lib/package_emd/utils/toimage.m | 3,003 | utf_8 | 82d44ccfe64bb1323e00c307e16baa67 | %TOIMAGE transforms a spectrum made of 1D functions in an 2D image
%
% [im,tt,ff] = TOIMAGE(A,f,t,splx,sply) transforms a spectrum made
% of 1D functions (e.g., output of "hhspectrum") in an 2D image
%
% inputs : - A : amplitudes of modes (1 mode per row of A)
% - f : instantaneous frequencies
% ... |
github | biolab-unige/wueLib-master | make_emdc.m | .m | wueLib-master/matlab/lib/package_emd/EMDs/make_emdc.m | 1,361 | utf_8 | 403408e17b436e17594d8a2bdd27ce6a | %MAKE_EMDC Compiles the C codes for Empirical Mode Decomposition
%
% Note: The compilation can fail on some systems (e.g. MacOS) if Matlab cannot find the C compiler.
% In this case, you should either install a C compiler or check Matlab configuration.
% The configuration files for compilation are mexopts.sh (Unix / M... |
github | biolab-unige/wueLib-master | emd.m | .m | wueLib-master/matlab/lib/package_emd/EMDs/emd.m | 22,283 | UNKNOWN | a1503bea6e500442db7e89931e19159d | %EMD computes Empirical Mode Decomposition
%
%
% Syntax
%
%
% IMF = EMD(X)
% IMF = EMD(X,...,'Option_name',Option_value,...)
% IMF = EMD(X,OPTS)
% [IMF,ORT,NB_ITERATIONS] = EMD(...)
%
%
% Description
%
%
% IMF = EMD(X) where X is a real vector computes the Empirical Mode
% Decomposition [1] of X, resulting in a ma... |
github | biolab-unige/wueLib-master | read_asa.m | .m | wueLib-master/matlab/src/readers/read_asa.m | 3,810 | utf_8 | 36dec5a2814e3cccc0e0d797792d0edf | function [val] = read_asa(filename, elem, format, number, token)
% READ_ASA reads a specified element from an ASA file
%
% val = read_asa(filename, element, type, number)
%
% where the element is a string such as
% NumberSlices
% NumberPositions
% Rows
% Columns
% etc.
%
% and format specifies the datatype a... |
github | biolab-unige/wueLib-master | wlb_EMGPCSSynch.m | .m | wueLib-master/matlab/src/core/wlb_EMGPCSSynch.m | 20,372 | utf_8 | 7746199b7afdbc2ad268618c2f4153a2 | function status = wlb_EMGPCSSynch(varargin)
%BN_TENSSYNCH synchronize multiple files in the same vhdr/eeg file
% FLAG = BN_TENSSYNCH(VARARGIN) I'll edit it when it will be ready
%
% Edited 2014-09-22 by Gabriele Arnulfo <gabriele.arnulfo@gmail.com>
%
%%% DEFINE SUPPORTED FILE EXTENSIONS %%%%
global globDebug... |
github | biolab-unige/wueLib-master | wlb_EEGPCSSynch.m | .m | wueLib-master/matlab/src/core/wlb_EEGPCSSynch.m | 18,016 | utf_8 | 99eecc11c88e496eb05360bd95c5fee6 | function status = wlb_EEGPCSSynch(varargin)
%BN_TENSSYNCH synchronize multiple files in the same vhdr/eeg file
% FLAG = BN_TENSSYNCH(VARARGIN) I'll edit it when it will be ready
%
% Edited 2014-09-22 by Gabriele Arnulfo <gabriele.arnulfo@gmail.com>
%
%%% DEFINE SUPPORTED FILE EXTENSIONS %%%%
global globDebug;
p =... |
github | biolab-unige/wueLib-master | wlb_convertActivaPCtoEEG_subjects.m | .m | wueLib-master/matlab/src/core/wlb_convertActivaPCtoEEG_subjects.m | 1,413 | utf_8 | 6966b48132c1a3f8baba825183f42d9c | function status = wlb_convertActivaPCtoEEG_subjects(fname)
%WLB_CONVERTACTIVAPCTOEEG_SUBEJCTS Description
% STATUS = WLB_CONVERTACTIVAPCTOEEG_SUBEJCTS(FNAME) Long description
%
logFid = fopen('C:\Users\andrea83\Desktop\logFile.log','w');
[parent, ~] = fileparts(fname);
% we are in the data dir containing all the su... |
github | gpeyre/2015-SIIMS-wasserstein-dual-master | lbfgsb.m | .m | 2015-SIIMS-wasserstein-dual-master/code/lbfgsb/Matlab/lbfgsb.m | 10,264 | utf_8 | cf0b737b65f70954855560be1aae6caf | function [x,f,info] = lbfgsb( fcn, l, u, opts )
% x = lbfgsb( fcn, l, u )
% uses the lbfgsb v.3.0 library (fortran files must be installed;
% see compile_mex.m ) which is the L-BFGS-B algorithm.
% The algorithm is similar to the L-BFGS quasi-Newton algorithm,
% but also handles bound constraints via an acti... |
github | gpeyre/2015-SIIMS-wasserstein-dual-master | load_image.m | .m | 2015-SIIMS-wasserstein-dual-master/code/toolbox/load_image.m | 20,960 | utf_8 | 66b6b4fc545ca907b495039f5c3bc41b | function M = load_image(type, n, options)
% load_image - load benchmark images.
%
% M = load_image(name, n, options);
%
% name can be:
% Synthetic images:
% 'chessboard1', 'chessboard', 'square', 'squareregular', 'disk', 'diskregular', 'quaterdisk', '3contours', 'line',
% 'line_vertical', 'l... |
github | gpeyre/2015-SIIMS-wasserstein-dual-master | inpolyhedron.m | .m | 2015-SIIMS-wasserstein-dual-master/code/toolbox/inpolyhedron.m | 22,756 | utf_8 | 16738ef64a83b8c37c57511248fb93cf | function IN = inpolyhedron(varargin)
%INPOLYHEDRON Tests if points are inside a 3D triangulated (faces/vertices) surface
% BY CONVENTION, SURFACE NORMALS SHOULD POINT OUT from the object. (see
% FLIPNORMALS option below for details)
%
% IN = INPOLYHEDRON(FV,QPTS) tests if the query points (QPTS) are inside ... |
github | gpeyre/2015-SIIMS-wasserstein-dual-master | load_volume.m | .m | 2015-SIIMS-wasserstein-dual-master/code/toolbox/load_volume.m | 7,540 | utf_8 | 7f6e9b7ddde675bc079739467fc889c4 | function h = load_volume(name, n, options)
% load_volume - load a 3-D data
%
% h = load_volume(name, n, options)
%
% Copyright (c) 2015 Gabriel Peyre
options.null = 0;
% helpers
t = linspace(0,1,n);
[X,Y,Z] = ndgrid(t,t,t);
sphere = @(c,r)( (X-c(1)).^2 + (Y-c(2)).^2 + (Z-c(2)).^2 )<= r^2;
cube = @(c,r) max( max... |
github | gpeyre/2015-SIIMS-wasserstein-dual-master | check_face_vertex.m | .m | 2015-SIIMS-wasserstein-dual-master/code/toolbox_meg/check_face_vertex.m | 669 | utf_8 | c940a837f5afef7c3a7f7aed3aff9f7a | function [vertex,face] = check_face_vertex(vertex,face, options)
% check_face_vertex - check that vertices and faces have the correct size
%
% [vertex,face] = check_face_vertex(vertex,face);
%
% Copyright (c) 2007 Gabriel Peyre
vertex = check_size(vertex,2,4);
face = check_size(face,3,4);
%%%%%%%%%%%%%%%%%%%%%%%... |
github | gpeyre/2015-SIIMS-wasserstein-dual-master | plot_graph.m | .m | 2015-SIIMS-wasserstein-dual-master/code/toolbox_meg/plot_graph.m | 2,140 | utf_8 | 337033b66fe405903639bcac59c2b34d | function h = plot_graph(A,xy, options)
% plot_graph - display a 2D or 3D graph.
%
% plot_graph(A,xy, options);
%
% options.col set the display (e.g. 'k.-')
%
% Copyright (c) 2006 Gabriel Peyre
if size(xy,1)>size(xy,2)
xy = xy';
end
if nargin<3
options.null = 0;
end
if not(isstruct(options))
col = op... |
github | gkiar/jhu-bme-master | sift_mosaic.m | .m | jhu-bme-master/computervision/cv_repo/proj1/sift_mosaic.m | 4,620 | utf_8 | f208d20eabb95160f194284a9a40776c | function mosaic = sift_mosaic(im1, im2)
% SIFT_MOSAIC Demonstrates matching two images using SIFT and RANSAC
%
% SIFT_MOSAIC demonstrates matching two images based on SIFT
% features and RANSAC and computing their mosaic.
%
% SIFT_MOSAIC by itself runs the algorithm on two standard test
% images. Use SIFT_MOSAI... |
github | gkiar/jhu-bme-master | encodeImage.m | .m | jhu-bme-master/computervision/cv_repo/hw6/practical-object-category-recognition-master/encodeImage.m | 4,087 | utf_8 | 80ffbb83f7e45a6575385bf21ea7b5b3 | function psi = encodeImage(encoder, im, cache)
% COMPUTEENCODING Compute a spatial encoding of visual words
% PSI = ENCODEIMAGE(ENCODER, IM) applies the specified ENCODER
% to image IM, reurning a corresponding code vector PSI.
%
% IM can be an image, the path to an image, or a cell array of
% the same, to op... |
github | gkiar/jhu-bme-master | randsign.m | .m | jhu-bme-master/sbe2/HW/hw9/randsign.m | 336 | utf_8 | c746e0c4c0b51dc69f520961cf72b03e | % Y=randsign(X,p)
% Randomly select a fraction of the entries of matrix X and flip their signs.
% p is the ratio of the number of flipped entries to the total number of entries.
function Y=randsign(X,p)
N=length(X(:));
nz=fix(p*N); % number of entries to be flipped
indx=randperm(N);
indx=indx(1:nz);
Y=X;
Y... |
github | gkiar/jhu-bme-master | randzero.m | .m | jhu-bme-master/sbe2/HW/hw9/randzero.m | 320 | utf_8 | f71d3e1951b89a194655f2e1db9206a5 | % W=randzero(W,p)
% Randomly select a fraction of the entries of matrix W and set them to 0.
% p is the ratio of the number of zeroed entries to the total number of entries.
function W=randzero(W,p)
N=length(W(:));
nz=fix(p*N); % number of entries to be set to 0
indx=randperm(N);
indx=indx(1:nz);
W(indx)=0; |
github | chudur-budur/nsga2-matlab-master | selection.m | .m | nsga2-matlab-master/selection.m | 2,175 | utf_8 | 3b2a2784315a9bc219eb5602bbbefb86 | function [ new_pop ] = selection(old_pop, new_pop)
% Applies tournament selection to generate a child population
% We did not vectorize this function as we want to keep this procedure
% separate from those of the crossover and the mutation. Otherwise
% implementation of different kind of selection strategy will... |
github | chudur-budur/nsga2-matlab-master | real_mutate.m | .m | nsga2-matlab-master/real_mutate.m | 3,069 | utf_8 | f6e6f2c56acd50374041d3ea81186388 | function [pvec] = real_mutate(pvec, pmut_real, eta_m, ...
min_realvar, max_realvar)
% This code applies polynomical mutation over pvec.
nreal = length(pvec);
if(nreal < 10)
pvec = polymut_looped(pvec, pmut_real, eta_m, ...
min_realvar, max_realvar);
el... |
github | chudur-budur/nsga2-matlab-master | real_cross.m | .m | nsga2-matlab-master/real_cross.m | 6,230 | utf_8 | 607c61f0e6f07192f2c5c55c0d4e82ed | function [ c_vec1, c_vec2 ] = real_cross( p_vec1, p_vec2, pcross_real,...
eta_c, min_realvar, max_realvar)
% Applies SBX over two vectors of double.
nreal = length(p_vec1);
epsilon = 1.0e-14 ;
% ncross = 0 ;
c_vec1 = zeros(1,nreal);
c_vec2 = zeros(1,nreal);
if(rand(1) <... |
github | chudur-budur/nsga2-matlab-master | save_pop.m | .m | nsga2-matlab-master/save_pop.m | 4,029 | utf_8 | aa67dca51218ef090b51b7c23cdf107b | function [] = save_pop(gen, current_pop, varargin)
% This function saves the pop in a file/matrix
% parameters:
% gen = current generation
% pop = current population to save
% is_burst = dump everything in one file or not, boolean
% extra_options = to save the final pop, say 'final'
% ... |
github | sabinaya/Resource-Allocation-VMS-master | skewnessRBF.m | .m | Resource-Allocation-VMS-master/skewnessRBF.m | 1,146 | utf_8 | b75b7cb7fb0ab4e78a670ae86b3ab907 | ## Copyright (C) 2015 ABINAYA
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed... |
github | redknightlois/caffe-master | prepare_batch.m | .m | caffe-master/matlab/caffe/prepare_batch.m | 1,298 | utf_8 | 68088231982895c248aef25b4886eab0 | % ------------------------------------------------------------------------
function images = prepare_batch(image_files,IMAGE_MEAN,batch_size)
% ------------------------------------------------------------------------
if nargin < 2
d = load('ilsvrc_2012_mean');
IMAGE_MEAN = d.image_mean;
end
num_images = length... |
github | redknightlois/caffe-master | matcaffe_demo_vgg.m | .m | caffe-master/matlab/caffe/matcaffe_demo_vgg.m | 3,036 | utf_8 | f836eefad26027ac1be6e24421b59543 | function scores = matcaffe_demo_vgg(im, use_gpu, model_def_file, model_file, mean_file)
% scores = matcaffe_demo_vgg(im, use_gpu, model_def_file, model_file, mean_file)
%
% Demo of the matlab wrapper using the networks described in the BMVC-2014 paper "Return of the Devil in the Details: Delving Deep into Convolutional... |
github | redknightlois/caffe-master | matcaffe_demo.m | .m | caffe-master/matlab/caffe/matcaffe_demo.m | 3,344 | utf_8 | 669622769508a684210d164ac749a614 | function [scores, maxlabel] = matcaffe_demo(im, use_gpu)
% scores = matcaffe_demo(im, use_gpu)
%
% Demo of the matlab wrapper using the ILSVRC network.
%
% input
% im color image as uint8 HxWx3
% use_gpu 1 to use the GPU, 0 to use the CPU
%
% output
% scores 1000-dimensional ILSVRC score vector
%
% You m... |
github | redknightlois/caffe-master | matcaffe_demo_vgg_mean_pix.m | .m | caffe-master/matlab/caffe/matcaffe_demo_vgg_mean_pix.m | 3,069 | utf_8 | 04b831d0f205ef0932c4f3cfa930d6f9 | function scores = matcaffe_demo_vgg_mean_pix(im, use_gpu, model_def_file, model_file)
% scores = matcaffe_demo_vgg(im, use_gpu, model_def_file, model_file)
%
% Demo of the matlab wrapper based on the networks used for the "VGG" entry
% in the ILSVRC-2014 competition and described in the tech. report
% "Very Deep Convo... |
github | AllenDowney/PhysicalModelingInMatlab-master | hypotenuse.m | .m | PhysicalModelingInMatlab-master/code/chap05/hypotenuse.m | 116 | utf_8 | c4239b2c1b22438fa4f15cca02083e0c | % Compute the hypoteneuse of a right triangle.
function res = hypotenuse(a, b)
res = sqrt(a^2 + b^2);
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | myfunc.m | .m | PhysicalModelingInMatlab-master/code/chap05/myfunc.m | 207 | utf_8 | 1d55356813be2563059fe629dc9fce4a | % Compute the Manhattan distance from the origin to the
% point on the unit circle with angle (x) in radians.
function res = myfunc(x)
s = sin(x);
c = cos(x);
res = abs(s) + abs(c);
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | logchaos.m | .m | PhysicalModelingInMatlab-master/code/chap04/logchaos.m | 1,061 | utf_8 | f377c77adce7074ecf7686b44810f85d | function logchaos
clf
hold on
% each time through the loop we try a different value of r
for r=2.4:0.01:4.0
% compute the first 50 values of the sequence
V = logmap(r, 0.5, 50);
% trim off the first 10 values
V = trim(V, 10);
% make another vector the same len... |
github | AllenDowney/PhysicalModelingInMatlab-master | exists.m | .m | PhysicalModelingInMatlab-master/code/chap08/exists.m | 200 | utf_8 | 9f8203143dffdc8dd284ae42a98dff3e | % Check whether any elements of an array are positive.
function res = exists(X)
for i=1:length(X)
if X(i) > 0
res = 1;
return
end
end
res = 0;
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | duck.m | .m | PhysicalModelingInMatlab-master/code/chap08/duck.m | 216 | utf_8 | 68e190bac9f76e37fb8a5048bd24335a | % Starting code for the duck problem.
function res = duck()
error = error_func(10)
end
function res = error_func(h)
rho = 0.3; % density in g / cm^3
r = 10; % radius in cm
res = h;
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | exists2.m | .m | PhysicalModelingInMatlab-master/code/chap08/exists2.m | 137 | utf_8 | f9530bd87cd042ac7d53775255578fa7 | % Use find to check where any elements of an array are positive.
function res = exists(X)
L = find(X>0)
res = length(L) > 0
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | mysum.m | .m | PhysicalModelingInMatlab-master/code/chap08/mysum.m | 157 | utf_8 | d14d02a60ef379cc6e0b853cfdbc6e10 | % Add up the elements of a vector.
function res = mysum(X)
total = 0;
for i=1:length(X)
total = total + X(i);
end
res = total;
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | earth.m | .m | PhysicalModelingInMatlab-master/code/chap11/earth.m | 1,375 | utf_8 | a72fa4c3f7d11e4cc165a7a2129d9f16 | % Simulate the Earth falling into the Sun.
function earth()
y0 = 150e9; % meters
t_end = 1e7; % seconds
t = 0;
X = [y0, 0];
rate_func(t, X)
tspan = [0, t_end];
options = odeset('Events', @event_func);
[T, M] = ode45(@rate_func, tspan, X, options);
% ... |
github | AllenDowney/PhysicalModelingInMatlab-master | freefall.m | .m | PhysicalModelingInMatlab-master/code/chap11/freefall.m | 652 | utf_8 | 3dd2e0a8630779a1aa3d318f644523d5 | % Rate function for an object in freefall.
function res = freefall(t, X)
y = X(1); % the first component is position
v = X(2); % the second component is velocity
dydt = v;
dvdt = acceleration(t, y, v);
res = [dydt; dvdt]; % pack the results in a column vector
end
function res = acce... |
github | AllenDowney/PhysicalModelingInMatlab-master | penny2.m | .m | PhysicalModelingInMatlab-master/code/chap11/penny2.m | 1,242 | utf_8 | 13b4041410f3bd4f1e5301dd51da6fd1 | % Simulate a penny falling from the Empire State Building.
% This version includes drag.
function penny2()
t = 0;
X = [381, 0];
rate_func(t, X)
tspan = [0, 30];
options = odeset('Events', @event_func);
[T, M] = ode45(@rate_func, tspan, X, options);
Y = M(:, 1);
V = M(:, 2);
plot(... |
github | AllenDowney/PhysicalModelingInMatlab-master | penny.m | .m | PhysicalModelingInMatlab-master/code/chap11/penny.m | 825 | utf_8 | b38f5da4a4b84ae56836b97c186dffa0 | % Simulate a penny falling from the Empire State Building.
function penny()
t = 0;
X = [381, 0];
rate_func(t, X)
tspan = [0, 10];
[T, M] = ode45(@rate_func, tspan, X);
Y = M(:, 1);
V = M(:, 2);
plot(T, Y)
xlabel('Time (s)')
ylabel('Altitude (m)')
saveas(gcf, '../../book/f... |
github | AllenDowney/PhysicalModelingInMatlab-master | skydiver.m | .m | PhysicalModelingInMatlab-master/code/chap11/skydiver.m | 1,255 | utf_8 | 7cce06b3cf19810c6476405cbfae7005 | % Simulate the descent of a skydiver.
function skydiver()
t = 0;
X = [4000, 0];
rate_func(t, X)
tspan = [0, 1000];
options = odeset('Events', @event_func);
[T, M] = ode45(@rate_func, tspan, X, options);
Y = M(:, 1);
V = M(:, 2);
plot(T, Y)
xlabel('Time (s)')
ylabel('Altit... |
github | AllenDowney/PhysicalModelingInMatlab-master | lorenz.m | .m | PhysicalModelingInMatlab-master/code/chap10/lorenz.m | 720 | utf_8 | e24550480142189c263aec0e8b466404 | % Solve the Lorentz system and plot the results.
function res = lorenz()
% Run the ode solver
[T, M] = ode45(@rate_func, [0 30], [1 2 3]);
% plot the results
X = M(:,1);
Y = M(:,2);
Z = M(:,3);
plot3(X, Y, Z)
xlabel('X')
ylabel('Y')
zlabel('Z')
% uncomment this to see the ... |
github | AllenDowney/PhysicalModelingInMatlab-master | lotka.m | .m | PhysicalModelingInMatlab-master/code/chap10/lotka.m | 1,060 | utf_8 | 875ad10e3b067f8089c4134f51f6c7b4 | % Simulate the Lotka-Volterra model and plot the results.
function res = lotka()
% test the rate function
t = 0;
V_init = [80, 20];
R = rate_func(t, V_init)
% run the ODE solver
tspan = [0, 200];
[T, M] = ode45(@rate_func, tspan, V_init);
% plot the time series
clf; hold o... |
github | AllenDowney/PhysicalModelingInMatlab-master | plot_cheby6.m | .m | PhysicalModelingInMatlab-master/code/chap07/plot_cheby6.m | 188 | utf_8 | 69981c13c9bf9d1583a124f203dcb955 | % Plot the 6th order Chebyshev polynomial.
function plot_cheby6(low, high)
X = linspace(low, high, 100);
for i=1:length(X)
Y(i) = cheby6(X(i));
end
plot(X, Y)
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | duck.m | .m | PhysicalModelingInMatlab-master/code/chap07/duck.m | 348 | utf_8 | a179759174fee2d8c2cf0b22db1b77e6 | function res = duck()
error = error_func(2)
ezplot(@error_func, [0, 20])
res = fzero(@error_func, 2);
end
function res = error_func(d)
rho = 0.3; % density in g / cm^3
r = 10; % radius in cm
mass_duck = 4/3 * pi * r.^2 * rho;;
mass_water = pi / 3 * (3*r*d.^2 - d.^3);
res =... |
github | AllenDowney/PhysicalModelingInMatlab-master | cheby6.m | .m | PhysicalModelingInMatlab-master/code/chap07/cheby6.m | 129 | utf_8 | 24ce9d048d389e24003a5cce2500af7a | % Evaluate the 6th order Chebyshev polynomial.
function res = cheby6(x)
res = 32 .* x.^6 - 48 .* x.^4 + 18 .* x.^2 - 1;
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | find_triples.m | .m | PhysicalModelingInMatlab-master/code/chap06/find_triples.m | 321 | utf_8 | d947579d26bc6bc7887583cb4561e6d2 | % Find Pythagorean triples up to `n`.
function res = find_triples (n)
for a=1:n-1
for b=a:n
if gcd(a,b) > 1
continue
end
c = hypotenuse(a, b);
if a^2 + b^2 == c^2
[a, b, c]
end
end
end
end
... |
github | AllenDowney/PhysicalModelingInMatlab-master | fib_triple.m | .m | PhysicalModelingInMatlab-master/code/chap06/fib_triple.m | 394 | utf_8 | 2c3221d9b03c27338fc31e943ebf7be9 | % Find Pythagorean triples using the first `n` Fibonacci numbers.
function res = fib_triple (n)
F(1) = 1;
F(2) = 1;
for i = 3:n
F(i) = F(i-1) + F(i-2);
end
for i = 1:n-3
a = F(i) * F(i+3);
b = 2 * F(i+1) * F(i+2);
c = F(i+1)^2 + F(i+2)^2;
... |
github | AllenDowney/PhysicalModelingInMatlab-master | proj1.m | .m | PhysicalModelingInMatlab-master/code/chap12/proj1.m | 309 | utf_8 | 390391cf77cd7c322601e905114ce611 | % Rate function for a projectile with no drag.
function dWdt = proj(t, W)
R = W(1:2);
V = W(3:4);
dRdt = V;
dVdt = acceleration(t, R, V);
dWdt = [dRdt; dVdt];
end
function dVdt = acceleration(t, R, V)
g = -9.8; % acceleration of gravity in m/s^2
dVdt = [0; g];
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | baseball2.m | .m | PhysicalModelingInMatlab-master/code/chap12/baseball2.m | 1,139 | utf_8 | cc93788bb1f4ef20382cb2e9d3d4bbc9 | % Simulate the flight of a baseball with drag.
function baseball2()
P = [0; 1]; % initial position in m
V = [40; 30]; % initial velocity in m/s
W = [P; V]; % initial condition
rate_func(0, W)
tspan = [0 6];
[T, M] = ode45(@rate_func, tspan, W);
X = M(:, 1);
Y = M(:, 2)... |
github | AllenDowney/PhysicalModelingInMatlab-master | diagram.m | .m | PhysicalModelingInMatlab-master/code/chap12/diagram.m | 2,805 | utf_8 | 17d6b8fa6bdfb7621cdecafd4bd25dd0 | % Draw a force diagram for a projectile with drag.
function diagram()
clf; hold on
blue = [0, 0.44, 0.74];
orange = [0.85, 0.32, 0.1];
xl = [-5, 5];
yl = [-5, 5];
draw_axes(xl, yl)
O = [0 0];
P = [3 4];
draw_vector(O, P, 'P', 'Color', blue)
xlim(xl)
ylim(yl)
hold off... |
github | AllenDowney/PhysicalModelingInMatlab-master | optimize.m | .m | PhysicalModelingInMatlab-master/code/chap12/optimize.m | 1,730 | utf_8 | 868a8a650b9fd47f9e5f3a4cd1462444 | function res = optimize(velocity)
% Find the angle that yields the maximum range for
% a given velocity.
angles = 20:70;
for i=1:length(angles)
angle = angles(i);
ranges(i) = range(velocity, angle);
end
plot(angles, ranges);
[m, i] = max(ranges);
best_angle = angles(i);
... |
github | AllenDowney/PhysicalModelingInMatlab-master | baseball.m | .m | PhysicalModelingInMatlab-master/code/chap12/baseball.m | 844 | utf_8 | 7533e765493cd8bcff73e71a6d7cf049 | % Simulate the flight of a baseball with no drag.
function baseball()
P = [0; 1]; % initial position in m
V = [30; 40]; % initial velocity in m/s
W = [P; V]; % initial condition
rate_func(0, W)
tspan = [0 8];
[T, M] = ode45(@rate_func, tspan, W);
X = M(:, 1);
Y = M(:, ... |
github | AllenDowney/PhysicalModelingInMatlab-master | proj2.m | .m | PhysicalModelingInMatlab-master/code/chap12/proj2.m | 605 | utf_8 | d82533de5d6c3cab6a6005c285f7fc56 | % Rate function for a projectile with drag.
function dWdt = proj(t, W)
R = W(1:2);
V = W(3:4);
dRdt = V;
dVdt = acceleration(t, R, V);
dWdt = [dRdt; dVdt];
end
function dVdt = acceleration(t, R, V)
g = 9.8; % acceleration of gravity in m/s^2
gravity = [0; -g];
m = 0.145;... |
github | AllenDowney/PhysicalModelingInMatlab-master | odeplot.m | .m | PhysicalModelingInMatlab-master/code/chap15/odeplot.m | 703 | utf_8 | 9c08e237c81708a58d6eb95958bcb12b | % Run ode45 and plot the locations where it evaluates the rate func.
function odeplot()
clf; hold on
total = 0;
y0 = 1;
tspan=[0 4];
options = odeset('Refine', 1);
[T, Y] = ode45(@rate_func, tspan, y0, options);
plot(T, Y, '-')
xlabel('t')
ylabel('y')
saveas(gcf, '../../book/f... |
github | AllenDowney/PhysicalModelingInMatlab-master | planet.m | .m | PhysicalModelingInMatlab-master/code/chap15/planet.m | 2,018 | utf_8 | 4556397ab226c90176c3122081196f9d | % Calculate and plot the trajectory of a planet acting under the force of gravity.
function planet()
d = 1; % initial distance between stars
v = 0.6; % initial velocity of the small one
m1 = 1; % mass of the large star
m2 = 1; % mass of the small star
P1... |
github | AllenDowney/PhysicalModelingInMatlab-master | coffee.m | .m | PhysicalModelingInMatlab-master/code/chap09/coffee.m | 415 | utf_8 | 3b707bbf8ade55a7f33c66dc2ef0e907 | % Use ode45 to predict coffee temperature.
function res = coffee()
t = 0;
y0 = 90;
r = rate_func(t, y0);
[T, Y] = ode45(@rate_func, [0, 60], y0);
plot(T, Y)
xlabel('Time (minutes)')
ylabel('Temperature (C)')
saveas(gcf, '../../book/figs/coffee.eps', 'epsc')
Y(end)
en... |
github | AllenDowney/PhysicalModelingInMatlab-master | euler.m | .m | PhysicalModelingInMatlab-master/code/chap09/euler.m | 457 | utf_8 | d519e8e5f47545f56013ed35763a31ff | % Make a plot showing results from euler.
function res = euler()
T(1) = 0;
Y(1) = 5;
dt = 0.1;
for i=1:40
r = rate_func(T(i), Y(i));
T(i+1) = T(i) + dt;
Y(i+1) = Y(i) + r * dt;
end
plot(T, Y)
xlabel('Time (hours)')
ylabel('Population (billions of c... |
github | AllenDowney/PhysicalModelingInMatlab-master | rats.m | .m | PhysicalModelingInMatlab-master/code/chap09/rats.m | 534 | utf_8 | 90f0abe2b9ae30360d88d138de91b877 | % Use ode45 to predict rat population growth.
function res = rats()
t = 365/2;
y = 1000;
res = rate_func(t, y);
%ts = linspace(0, 365);
%ys = rate_func(ts, 2000);
%plot(ts, ys);
[T, Y] = ode45(@rate_func, [0, 365], 1000);
plot(T, Y)
xlabel('Time (days)')
ylabel('... |
github | AllenDowney/PhysicalModelingInMatlab-master | runge.m | .m | PhysicalModelingInMatlab-master/code/chap09/runge.m | 687 | utf_8 | 7c5e488d6f99289791b19b1a71c0a867 | % Make a plot comparing results from euler and runge-kutta
function res = runge()
clf; hold on
T(1) = 0;
F(1) = 5;
dt = 0.1;
for i=1:40
r = rate_func(T(i), F(i));
T(i+1) = T(i) + dt;
F(i+1) = F(i) + r * dt;
end
plot(T, F)
xlabel('Time (hours)')
... |
github | AllenDowney/PhysicalModelingInMatlab-master | manny.m | .m | PhysicalModelingInMatlab-master/code/chap13/manny.m | 3,544 | utf_8 | 818105d668b3de5cb552407e19e2c7b4 | % Solve the Manny Ramirez problem using a golden section search.
function res = manny()
% find the velocity that _just_ gets the ball over the wall
initial_guess = 45; % m/s
velocity = fzero(@crossover_func, initial_guess);
res = velocity;
end
function res = crossover_func(velocity)
% this... |
github | AllenDowney/PhysicalModelingInMatlab-master | baseball_anim.m | .m | PhysicalModelingInMatlab-master/code/chap13/baseball_anim.m | 1,403 | utf_8 | 4f5c2f79de797f8edeee7d55395c69f4 | % Animate the flight of a baseball.
function baseball_anim()
P = [0; 1]; % initial position in m
V = [40; 30]; % initial velocity in m/s
W = [P; V]; % initial condition
rate_func(0, W)
tspan = 0:0.1:10;
options = odeset('Events', @event_func);
[T, M] = ode45(@rate_func, tsp... |
github | AllenDowney/PhysicalModelingInMatlab-master | golden.m | .m | PhysicalModelingInMatlab-master/code/chap13/golden.m | 2,254 | utf_8 | 9d78db9673b32eff8921c03550399bb4 | % Demonstrate a golden section search.
function res = optimize(V)
x1 = V(1);
x2 = V(2);
x3 = V(3);
fx1 = height_func(x1);
fx2 = height_func(x2);
fx3 = height_func(x3);
for i=1:50
if x3-x2 > x2-x1
x4 = (x2+x3) / 2;
fx4 = height_func(x4);
if fx4 >... |
github | AllenDowney/PhysicalModelingInMatlab-master | baseball3.m | .m | PhysicalModelingInMatlab-master/code/chap13/baseball3.m | 2,062 | utf_8 | 7bfc0cf9ff0234da9174c9740ac4811f | % Plot distance flown versus launch angle for a baseball.
function baseball3()
P = [0; 1]; % initial position in m
V = [40; 30]; % initial velocity in m/s
W = [P; V]; % initial condition
rate_func(0, W)
tspan = [0 10];
options = odeset('Events', @event_func);
[T, M] = ode45... |
github | AllenDowney/PhysicalModelingInMatlab-master | manny2.m | .m | PhysicalModelingInMatlab-master/code/chap13/manny2.m | 2,910 | utf_8 | c7eff5c7b01fd3670806b81b33db56c2 | % Solve the Manny Ramirez problem using fminsearch.
function res = manny()
% find the velocity that _just_ gets the ball over the wall
initial_guess = 45; % m/s
velocity = fzero(@crossover_func, initial_guess);
res = velocity;
end
function res = crossover_func(velocity)
% this function cro... |
github | AllenDowney/PhysicalModelingInMatlab-master | optimization.m | .m | PhysicalModelingInMatlab-master/code/chap13/optimization.m | 229 | utf_8 | e9871de42e3e543086e4bb9c43a4dbd1 | % Demonstrate fzero and fminsearch.
function optimization()
x = fzero(@error_func, 1)
x = fminsearch(@error_func, 1)
[x, fval] = fminsearch(@error_func, 1)
end
function res = error_func(x)
res = x^2 - 2;
end
|
github | AllenDowney/PhysicalModelingInMatlab-master | binary.m | .m | PhysicalModelingInMatlab-master/code/chap14/binary.m | 3,464 | utf_8 | 27adbe1d77da0610858b2006fe5e3fb0 | % Calculate and plot the trajectories of two bodies with
% the given parameters, acting under the force of gravity.
function binary()
au = 150e9; % astronomical unit in meters
day = 24 * 60 * 60; % year in seconds
sunmass = 2.0e30; % mass of the sun in kg
d = 779e9; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.