text
stringlengths
8
6.12M
clear; %清理内存 clc;%清理屏幕 close all; %format comnact;%定义数据显示样式为紧凑格式 %tic 开始计时, toc 结束记时 A = [10:0.01:12];%生成随机数 prices = randsrc(100,1,A);% dates = [today-99:today]'; TimeSeries = fints(dates,prices,'close') %%读取fints数据类型 TimeSeries.dates %提取数据,0表示只提取数据,1表示提取数据和日期 TimeSeries1 = fts2mat(TimeSeries,0,'close') TimeSeries(...
function MakeDotH(RFOut,gOut,dt) rf_max = max(abs(RFOut(:))); rf_normalized = RFOut/rf_max; g01_max = max(abs(gOut(:,1))); g01_norm = gOut(:,1)/g01_max; g02_max = max(abs(gOut(:,2))); g02_norm = gOut(:,2)/g02_max; rf_phase = angle(RFOut); for ii = 1:length(rf_phase) if rf_phase(ii) < 0 rf_phase(ii) = rf_pha...
clear; clc dataLocation rng(seed); load(strcat(data_dir, 'anno.mat')) data_size = size(anno); data_set = cell(0); % get images for i = 1:data_size(1) imname = anno(i,1); imname = imname{1}; info = struct(); info.name = imname; bounding_boxes = anno(i,2); bounding_boxes = bounding_b...
function varargout = StringSimulationGui(varargin) % STRINGSIMULATIONGUI MATLAB code for StringSimulationGui.fig % STRINGSIMULATIONGUI, by itself, creates a new STRINGSIMULATIONGUI or raises the existing % singleton*. % % H = STRINGSIMULATIONGUI returns the handle to a new STRINGSIMULATIONGUI or the hand...
function sc_feat = compute_sc( points, nvert, points_num, bins_num, r_inner, r_outer) % suppose the points are in order if nargin <= 4 r_inner=1/8; r_outer=2; end if nargin <= 2 points_num = 100; bins_num = [8, 10]; end if nargin <= 1 nvert = 5; end verts = points( round(1 : size(points, 1)/nvert : s...
function [ schedule ] = create_treat_sched( length, treat_length, rest_length ) schedule=zeros(length,1); index=1; treatment=1; % 1 if treatment period, 0 if rest period, start with treatment while index <= length period_length=0; if treatment > 0 period_length=treat_length; ...
function [x,P,count] = SRFT_ls_over(A,b,eps,l,conj_grad) % This algorithm solves overdetermined Least Squares Problem Ax=b with % A of size m by n and m >= n by means of SRFT % Input: A: target matrix % b: target result vector % eps: tolerance for conjugate gradient iterations % l: parameter used i...
## Copyright (C) 2011 jakub ## ## 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 2 of the License, or ## (at your option) any later version. ## ## This program is distri...
function [x,f,R] = minentropy(A,b,d,varargin) % min_x sum_j d_j x_j log(x_j) % s.t. Ax = b % x >= 0 % % see page 18 in paper (Skajaa, Ye) if nargin > 3 pars = varargin{1}; end [M,N] = size(A); b = b(:); M2 = length(b); if M ~= M2 error('A and b do not match'); end pars.n = 3*...
im=imread('1.jpg'); figure(1) imshow(im); title('Actual Image'); se = strel('ball',5,5); img = imdilate(im,se); figure(2); imshow(img); title('Surface made smooth'); im1=rgb2gray(img); figure(3); imshow(im1); title('RGB To greylevel'); th=graythresh(im1); im2=im2bw(im1,th); figure(4); imshow(im2); title('GreyLe...
function [std_f,mean_f] = recog_trck() imaqreset; close all; clc; i=1; n=5; global std global mean std=0;mean=0; vid = videoinput('winvideo',1,'YUY2_320x240'); while (1==1) choice=menu('Face Recognition',... 'Taking photos for recognition',... 'Exit'); if (choice==1) FD...
function fv = f_values_vector(a,b, step, f) fa = a:step:b; fv = ones(1,length(fa)); for i=1: length(fa) fv(i) = feval(f, fa(i)); end %fv = feval(f, fa);
clear clc; close all; r_c = 0.00635/2; r_e = 0.202/2*10^-3; d = 0.05; U = 10; syms xi eta n xi2 xi1 %% set constants % set problem geometry in bipolar coordinates xi2_val = 2.82017; xi1_val = -6.26456; a = sqrt(r_c^2*sinh(xi2_val)^2); %% initialize bipolar variables %[xi_val,eta_val] = mesh...
close all clear all clc load('glider1_states_6.mat') load('glider2_states_6.mat') format long %% Plot altitude variation figure1 = figure('Color',[1 1 1]); plot(glider1_states(2502:181299-107500,1)-glider1_states(2502,1),glider1_states(2502:181299-107500,3),'r','LineWidth',1.5) hold on plot(glider2_states(735:179517...
X = [ 2 2.3 0.4 -1.9 -3.2 -0.4 4.1 -5; ... -1.3 4.5 0.4 -4.3 -4.1 -5 1.4 -4.7]; T = [ 0 0 0 1 1 1 0 1;... 1 0 0 0 0 1 1 0]; net = perceptron('hardlim', 'learnp'); firstX = X; firstT = T; net = configure(net, firstX, firstT); W = rand(1,7) * 10 - 5 net.IW{1,1} = [W(1:2); W(3:4)]; net.b{1} = W(5:6)'; net = i...
%% Determinação do Momento de Inércia %% close all %% Seleção das da massa e seu centro de massa %% s = input('Experimento com massa única(1) ou as duas massas(2): '); switch s case 1 m = 0.930; % Kg R = 0.292; % m case 2 m = 0.930 + 0.922; % m1 + m2 = 1.852 Kg R = 0.319; ...
function [A] = getAmatrix(varargin) P = path; % Fill in the complete path for the downloaded yaleBfaces directory within the single quotes in the line below path(P,'/Users/manu/*****/assgn4/yaleBfaces'); if nargin ~= 2 disp('You must specify two arguments. Explicitly set to empty [] an argument you wish to excl...
close all force clear all data = [-2.00 -3.00 4.00 -7.00 0.00 4.00]; theta = 0; thetas = [theta]; tic for i = 1:10500 theta_prop = -2 + (4 * rand) %-------------------------------------------------------------------------- prod1 = prod(exp((-1/8)*(theta - theta_prop)*(data.*2 - theta_prop - theta))) %----------...
function test_suite = test_distancePoints %TESTDISTANCEPOINTS One-line description here, please. % output = test_distancePoints(input) % % Example % testDistancePoints % % See also % % % ------ % Author: David Legland % e-mail: david.legland@grignon.inra.fr % Created: 2009-04-22, using Matlab 7...
#include "com_codename1_io_FileSystemStorage_1.h" const struct clazz *base_interfaces_for_com_codename1_io_FileSystemStorage_1[] = {}; struct clazz class__com_codename1_io_FileSystemStorage_1 = { DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_io_FileSystemStorage_1 ,0 , &__GC_MA...
% this is steady state solution % create cell of parameters paramDefinition; clear load paramValues eta = paramValues.eta; beta = paramValues.beta; epsilon = paramValues.epsilon; alpha = paramValues.alpha; delta = paramValues.delta; Xst = epsilon/(epsilon-1); rho = paramValues.rho; theta = par...
% mixer_init(blk, varargin) % % blk = The block to initialize. % varargin = {'varname', 'value', ...} pairs % % Valid varnames for this block are: % freq_div = The (power of 2) denominator of the mixing frequency. % freq = The numerator of the mixing frequency % nstreams = The number of parallel streams provide...
clear; clc xdata = xlsread('InfantMortalityData.xlsx','Sheet2','A2:A27'); ydata = xlsread('InfantMortalityData.xlsx','Sheet2','B2:B27'); xdata; ydata; xsmall = 2; xlarge = 27; [x, dy] = firstderivativedata('InfantMortalityData' , '2', '27', '2', '27'); length(x); length(dy); [xa, dya] = secondderivati...
function [q,Ainv,detA,flag] = PCLevFad(A) %PCLevFad Determine characteristic polynomial, matrix inverse and %determinant flag = true; A_size = size(A); if A_size(1) ~= A_size(2) Ainv = []; q = []; detA = 0; flag = false; return; end len = A_size(1); Bn = eye(len); I = eye(len); q = zeros(1,(len + ...
%The output is a structure with H,F,G,J such that S(z) = H (z^{-1}I - F)^-1 G + J function S = TF_S(sys) Klqr = sys.Klqr; P = sys.P; R_e = inv (sqrtm(( sys.R + sys.B'*P*sys.B )')); S.H = R_e*sys.B'*sys.W*sys.A; S.F = sys.A; S.G = eye(size(S.F)); S.J = R_e*sys.B'*sys.W; % S.dim = size...
function []=plotearth2(x,y,z,rad,im) % imgRGB = imread('we5.png'); imgRGB = im; [imgInd,map] = rgb2ind(imgRGB,256); [imgIndRows,imgIndCols] = size(imgInd); [X,Y,Z] = sphere(imgIndRows,imgIndCols); surface((X*rad)+x,(Y*rad)+y,(Z*rad)+z,flipud(imgInd),... 'FaceColor','texturemap',... 'EdgeColor','none',.....
dt = 1; % timestep (1s) g = 9.81; % gravity (m/s^2) A = [1, 0, dt, 0; 0, 1, 0, dt; 0, 0, 1, 0; 0, 0, 0, 1]; B = [0; 0; 0; -g*dt]; mu = zeros(4, 1); Q = [20, 0, 5, 0; 0, 20, 0, 5; 5, 0, 10, 0; 0, 5, 0, 10]; % initial condition means xhat = [0; 0; 100; 100]; % initial conditions covari...
%% Yang Wang - EM unsupervised training %% using all 4 features; no shared covariance matrix %% preparation clear; close; load('data1.mat'); y = logical(data(:, 5)); % for testing only cIt = 5000; % count of iterations %% arbitrarily assigned labels: randomly initialized yhat = rand(100, 1) > 0.5; %% training misRat...
% @b_k: rudder angle control signal % @psi_k: measured compass angle % @init_data: initialization values % returns: % @b_est: estimated rudder angle % @psi_est: estimated compass angle % the init_data will be kept persistent while in loop function [psi_est, b_est] = kalman_filter(b_k, psi_k, in...
function [ C ] = matlab_mldivide( A, B ) %MATLAB_MLDIVIDE Summary of this function goes here % Detailed explanation goes here C = A \ B; end
function [output_file] = run_neato(filename, extra_args) if nargin < 2 extra_args = ''; end [pathstr,name,~] = fileparts(filename); output_file = fullfile(pathstr,[name '.png']); cmdline = strjoin({'/usr/local/bin/neato', extra_args, filename, '-Tpng', ['-o' output_file]}, ' '); retcode = system(cmdline); if retcod...
function [gameMoves, ifWon]=connect4F(aggregateMoves, numTimesWon) %clc %clear gameMoves = zeros(1, 21); ifWon =0; %disp(' ') %disp('Great! Here we go!!') %disp('At any time press CTRL and C to end game.') %disp(' ') %disp('LET THE GAME BEGIN!') %disp(' ') field = zeros(6,7); %disp(field) player = 1; ...
function on_tau_local = fct_on_tau(model,nabla_phi,w_eul,w_Lag) % Compute the inverse of the local time scale of differntial advection % MX=model.grid.MX; x=model.grid.dX(1)* (0:(MX(1)-1)) ; x=x-mean(x); y=model.grid.dX(2)* (0:(MX(2)-1)) ; y=y-mean(y); [x,y]=ndgrid(x,y); r=sqrt(x.^2+y.^2); MX=model.grid.MX; w_Lag=per...
% Reconstruction with a set of peripheral mosaic % for comparison with the denoiser prior reconstruction % LQZ, Jan 25, 2022 %% setup imageSize = [100, 100, 3]; display = displayCreate('CRT12BitDisplay'); prior = load('sparsePrior.mat'); renderMtx = load('periRender.mat'); renderMtx = renderMtx.renderMtx; load('inp...
function [X, Y, E] = LinApp_CSL(funcname,param,X0,Z,NN,... logX,EE,Eps,Phi,Sylv,Y0) % Version 1.1, written by Kerk Phillips, October 2016 % % Generates a history of X & Y variables by linearizing the policy function % about the current state as in Evans & Phillips cited below. % % This function ...
%%%%%%%%%%%%%%%% PLOT SNAKES %%%%%%%%%%%%%%%% % % Plots the extracted snake boundaries on each image and saves the images. % % Inputs: % snakeType - sets which iteration of the blob variable is plotted (options: 'snakeTrack, 'snakeAutoRemove', 'snakeManRemove') % background % N - the number...
% Copyright 2016-2020 Juliane Mai - juliane.mai(at)uwaterloo.ca % % License % This file is part of Juliane Mai's personal code library. % % Juliane Mai's personal code library is free software: you can redistribute it and/or modify % it under the terms of the GNU Lesser General Public License as published by % the Free...
% plot optical power sweep results: %% % load('optPowerSweep_R2B_TD69_M1_20190107T175533.mat') % load('optPowerSweep_R2B_TD70_M1_20190107T195727.mat') % load('optPowerSweep_R2B_TD73_M1_20190107T210207.mat') % load('optPowerSweep_R2B_TD74_M1_20190108T145748.mat') % load('optPowerSweep_R2B_TD76_M1_20190108T170726.mat') ...
function programHelpMenu() % Opens the .pdf help maual form the help directory try addpath Help; open('helpManual.pdf') catch ERROR disp('You must have an active .pdf reader to read the help manual'); end
function path=PortMap(what) switch what case 'BackupFile' path='C:\support\NVC\MATLAB_Code_111Lab\Data\TempDataBackup\Temp.mat'; case 'BackupImageFile' path='C:\support\NVC\MATLAB_Code_111Lab\Data\TempDataBackup\TempImage.mat'; case 'Ctr src' path='/Dev1/PFI8'; case {'Ct...
function [dime, glen, wout, bulk, bc,digits, selectsolver, dielx_str, diely_str, dielz_str, kappa_str, charge_str, pqr_str, pqr_cent_str, srfm_str, chgm_str, ener_str,in_nam_str, out_nam_str] = read_inm(inputfile) file_id = fopen(inputfile, 'rt'); % open the file %% dime line=fgetl(file_id); [dime, count, errms...
global baseParameters fparam parami nbin Acell calP2X7 iparam parami baseModel pMax pMin; pMax=containers.Map(); pMin=containers.Map(); %Create a cell array of strings with the names of the parameters. paramNames={'k1','k2','k3','k4','k5','k6','k7','k8','k9','k10','k11','k12','k13','k14','k15','k16','k17','k18','k19...
function rgb = cadet_blue rgb = [0.37254, 0.6196, 0.62745]; end
%Transformada cinemática inversa para un robot de 6GDL syms L1 L2 L3 L4 q1 q2 q3 q4 q5 q6 real %Declaración de variables %Transformación de 0 a 1 A0_1 = [cos(q1) -sin(q1) 0 0; sin(q1) cos(q1) 0 0; 0 0 1 0; 0 0 0 1]; %Transformación de 1 a 2 A1_2 = [1 0 0 0; 0 1 0 0; 0 0 1 L1; 0 0 0 1]*... [1 0 0 0; 0 cos(-pi/2) -...
clear all; close all; clc; label = 'hhp'; load(['./mat_files/hw1_sim_data_' label '.mat']) %% PSF B-mode % writerObj1 = VideoWriter('focusTxPSF.avi') writerObj1.FrameRate = 10; open(writerObj1); % writerObj2 = VideoWriter('pwTxPSF.avi') writerObj2.FrameRate = 10; open(writerObj2); for i = 1:length(z_array) figure...
function P4(w) wa=w.K wb=w.N [~,x]=sort([w.K]); wa=wa(x); wa=[wa 1000000]; wb=wb(x); wb=[wb 1000000]; s=size(wa); tmp=wa(1); sum=0; for ii=1:s(2) if wa(ii)==tmp sum=sum+wb(ii); tmp=wa(ii); end if wa(ii)~=tmp fprintf("K=%d sum(N)=%d\n",tmp,sum); sum...
function ampImage = tofComputeAmplitude(dcsImages) ampImage = sqrt(((dcsImages.DCS2-dcsImages.DCS0)./2).^2 + ((dcsImages.DCS3-dcsImages.DCS1)./2).^2); end
function [traces_async, loopBegins] = generate_async_traces(W, loopBegins, tau, upperLimit, varargin) if nargin == 5 stutter_prob = varargin{1}; else stutter_prob = 0.1; end % Original time horizon k = size(W{1},2)-1; h = k; % Gives state vector index in loop at 'time' time_to_state_pos = @(time) (time<=k)*(...
function [J, grad] = costFunctionReg(theta, X, y, lambda) %COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization % J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using % theta as the parameter for regularized logistic regression and the % gradient of the cost w.r.t. ...
clear clc close all for i=1:50000000 p(i) =rand()+rand()+rand(); end hist(p,1000);
function [B,C,dd_start,dd_end]= funcz( A ) %UNTITLED 此处显示有关此函数的摘要 % 此处显示详细说明 %本函数适用于插值,形参A为插值对象 x=A(:,1); u=A(:,2); v=A(:,3);%%%%%%%%%%%%% t=length(x); s0=1; t0=1; dd_start=[]; dd_end=[]; for i=1:t-1 if (x(i+1)-x(i))>0.0031 dd_start=[dd_start i]; dd_end=[dd_end i+1]; n=floor((x(i+1)-x(i))/...
function [Bx, By, Bz, BR, BPhi] = ... calc_b_RPhiZ(coilset, P_R, P_Phi, P_Z, coil_current_array) % function [Bx,By,Bz,Br,Bphi] = calc_b_QHS46_RPhiZ(P_R, P_Phi, P_Z, % coil_current_array) % % Input: P_R, P_Phi, P_Z: Cylindrical coordinates of the observation point % coil_current_array: The current in ...
clear all; %% M = csvread('pyradiomics_v4_T1_norm_results.csv',1); Num = M(1:end,1); X = M(1:end,3:end); Y = M(1:end,2); save T1_data.mat Num X Y %% M = csvread('pyradiomics_v4_T2_norm_results.csv',1); Num = M(1:end,1); X = M(1:end,3:end); Y = M(1:end,2); save T2_data.mat Num X Y %% M = csvread('pyradiomics_merge_T1_T2...
function [ MaxAccurate,window,Accurate,xlab] = Bestwindow( Label,Train,bestc,bestg,x,y ) %BESTWINDOW Summary of this function goes here % Detailed explanation goes here Accurate = zeros(y-x,1); xlab = zeros(y-x,1); for i = x:y P_S = SVMforecast(Label,Train,bestc,bestg,i); R_S = Label(i+1:end-1,:); k...
function w = colormle(A,samples1) samples=samples1'; size(samples); k=max(max(samples)); gam=0.01; its=1000; temp=zeros(1,k); w = ones(1, k); for s=1:size(samples,1) for i=1:size(samples,2) j=samples(s,i); temp(j)=temp(j)+1; end end temp = temp/ size(samples, 2); while ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov> % Notices: % % Copyright @ 2020 United States Government as represented by the % Administrator of the National Aeronautics and Space Administration. All % Rights Reserved. % % Disclaimers % % No Warranty:...
function [gait] = parse(nlp, sol) %% parse the optimization results to more readible structure data [tspan, states, inputs, params] = exportSolution(nlp, sol); tspan{3} = tspan{1}(end) + (tspan{1} - tspan{1}(1)); gait = struct(... 'tspan', tspan,... 'states', sta...
% Use Octave to run this script. % Generate some data. angles = -2*pi:0.01*pi:2*pi; c = cos(angles); s = sin(angles); % Plot figure. plot(angles, [c' s'], 'linewidth', 2); axis([-2*pi, 2*pi, -1.1, 1.1]); grid on; % Set figure sizes for paper. set(gcf, 'paperunits', 'centimeters'); set(gcf, 'paperposition', [1 1 12 8...
max = abs(major_points_width_position(1) - major_points_width_position(2)); height_start=1; height_end=2; for i=2:length(major_points_width_position)-1 temp = abs(major_points_width_position(i) - major_points_width_position(i+1)); if( temp > max) max = temp; height_start = major_points_width_pos...
%%% STATS 2021 analysis %%% % Joel Frohlich % University of California, Los Angeles (UCLA) % Monti Lab, Psychology Department % % University of Tuebingen, Germany % Institue for Neuromodulation and Neurotechnology % % Last update: 12 Dec, 2022 (cleaned up code and comments) % For each subject, the code perf...
%--------------------------------------------------------------- % getpoints - Generate x and y points that define an ellipse, given a 2x2 % covariance matrix, C. z, if requested, is all zeros with same shape as % x and y. function [x,y,z] = getpoints(C,clipping_radius) n=100; % Number of points around ellipse p=0...
res = autorotate(im,bf); first_crop = im(res.crop1(1):res.crop1(2),res.crop1(3):res.crop1(4)); figure();imagesc(first_crop);colormap gray; axis image; rotate_im = imrotate(first_crop,res.phi,'crop'); figure();imagesc(rotate_im);colormap gray; axis image; final_crop = rotate_im(res.crop2(1):res.crop2(2),res.crop2(3):res...
% run 4 % mean interspike interval as a function of noise intensity % for a fixed coupling strength ntrials = 10; kappa = 0.3; t = [0:0.01:300]; noise = {'Subunit', 'FoxLuSystemSize', 'VClamp'}; noise_intensity = 0:0.2:7; n_neurons = 2; isi_vec_su = zeros(1, length(noise_intensity)); isi_err_su = zeros(1, l...
%Walsh-Harmard Transform with Tow level Discrete Wavelete Transform for % Color image Decompression % Designed by Mohammed M. Siddeq % Data 2012-2-22 % Email :- mamadmmx76@yahoo.com % % this program is used for Decompress grayscale images by using : % INPUT\ Header : this parameter contains all infmration...
function smoothed = sm_filter(x, width) smoothed = []; k = (width - 1) / 2; for i = 1:k smoothed = [smoothed, mean(x(i-(i-1):i+k))]; end for i = (k + 1):(size(x, 2) - k) smoothed = [smoothed,mean(x(i-k:i+k))]; end for i = (size(x, 2) - k):(size(x, 2)-1) smoothed = [sm...
function output = gasViz(rho) sg = 0.6; T = 150; MW = sg*29; K = (9.379 + 0.01607*MW)*(T+460)^1.5/(209.2+19.26*MW+T); X = 3.448 + 986.4/(T+460) + 0.01009*MW; Y = 2.447 - 0.2224*X; output = 1e-4*K*exp(X*(rho/62.4)^Y); end
function [ stair_fun ] = stair_clearance( nlp ) %periodicity constraint for periodicity % Creates SymFunction for a periodicity constraint % % Author: Ross Hartley % Date: 2018-03-19 % Choose frames switch nlp.Plant.Name case 'RightStance' H = nlp.Plant.ContactPoints.LeftToeBottom.compute...
function [mu] = fuzzy_lowmid(val,low,mid) if val < low mu = 1; elseif val > low && val < mid mu = (mid-val)/(mid-low); elseif val > mid mu = 0; end end
function pl1_ex3(fonte) [~, ~, ext] = fileparts(fonte); [alf, f] = readfonte(fonte, ext); histograma(f, alf); x = entropy(f); disp('entropy: '); disp(x); end
%-------------------------------------- % Overlaping problems %-------------------------------------- % % check overlapping % % % [n_r kk] = size(best_bboxes); % % if ( n_r > 1 ) % % for bb = 2:n_r % best_limit1 = best_bboxes(bb, 1:2); % best_limit2 = best_bboxes(bb,...
function Set( tSignal, iDeviceID, iSignalID, afValues, afXAxis, afYAxis, afX, afY, afZ ) % tSignal.iDeviceID = iDeviceID; tSignal.iSignalID = iSignalID; % tSignal.afX = afX; tSignal.afY = afY; tSignal.afZ = afZ; % tSignal.SetInvalidDataMarker(); tSignal.SetDescription(); % % those elements are in this...
function [v] = ConnectMouseFeetAndBody(v,p) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function [v] = ConnectMouseFeetAndBody(v,p) % % Find which leg corresponds to which body and which leg is which. % % (c) Imre Bartos 2013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function [ shapes ] = GenPearls( inshape, swatches, nr_colors ) %GENPEARLS Summary of this function goes here % Detailed explanation goes here %imshow(img); im1 = rgb2gray(im2double(inshape)); shapemask = (im1 > 0); %imshow(shape); swatches = im2double(swatches); colors = zeros([nr_colors, 3]); [swatch_r, swatc...
Fs=100; t=0:1/Fs:10; s=sin(t); sptool
function AnalyzeCurrentModel %% set images and params folder locations xtPlotFolder = 'G:\My Drive\data_sets\nn_RigidRot\natural_images\xt'; filterFolder = 'G:\My Drive\data_sets\nn_RigidRot\saved_parameters\'; %% get the fit outputs. Default to the last one generated param_list = dir([filterFo...
X0 = [0.1;0.1;0.1;0.1]; %Initial Conditions A = [-0.75,1,0,0; 0,-0.9,1,0; -1,0,0,1]; B = [0;0;0]; Aeq = []; Beq = []; LB = [0;0;0;0]; UB = [0.1524;Inf;Inf;Inf]; X = fmincon(@(X) FUN(X),X0,A,B,Aeq,Beq,LB,UB) % FUN = Static Margin Equation (Subsonic, non-corrected for alpha) M = MARGIN(X) %x_axis = [0,4.05118...
function linearODESolveP2X4Inact2block3() global d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22 d23 d24 k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 k13 k14 k15 k16 k17 k18 k19 k20 k21 k22 k23 k24 L10 L11 L12 L13 L14 L20 L21 L22 L23 L24 L30 L31 L32 L33 L34 L40 L41 L42 L43 L44 L50 L51 L52 L53 ...
numbers=1:10; disp(length(numbers)) sum=0; vector=zeros(1:length(numbers)); disp(numbers) for i=1:length(numbers) sum=sum+i; vector(i)=sum; % disp(sum) end
clc clearvars close all system('ms.exe 2000 1 -t 16.4 -r 100.0 2501 -G 6.93 -eG 0.2 0.0 -eN 0.3 0.5 >ms_output.txt'); OUT=readmsoutput('ms_output.txt'); gametes=(OUT.gametes{1}); [n,p]=size(gametes); gametes=gametes(randperm(n),:); g=zeros(n/2,p); for k=1:2:n g((k+1)/2,:)=sum(gametes([k,k+1],:)); end mafv=sum(g)./n; ...
function [CorFamRes,CorDevRes,CorElemRes,MaxEffRes,BpmFamRes,BpmDevRes]= mec3(QuadFamily,QuadDev,Plane,CorBpmResp,CorNumb) % MEC % function [CorFam,CorDev,MaxEff]= mec(QuadFamily,QuadDev,Plane,CorBpmResp) % % INPUTS -> VALUES % % 1. QuadFamily: Family of the q...
clear; set(0,'defaultaxesfontsize',20); format long %%% p4c.m MCMC RWM algorithm for double well (Ex. 5.6) %% setup C0=5;% variance of the prior m0=4;% mean of the prior sd=1;rng(sd);% choose random number seed T=1; tau=0.1; t=[0:tau:T]; N=length(t);% time discretization gamma=1;% observational noise variance is gamma...
% Copyright (c) 2012 Howard Hughes Medical Institute. % All rights reserved. % Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms. % http://license.janelia.org/license/jfrc_copyright_1_1.html function [label, parent] = newSource() handles.label = ''; handles.parent = ''; ...
%REMOVEVARIABLE A helper function that removes a given pair from a list of %pairs. Returns the original list of the pair is not found. % %Arguments: % variable - the pair to remove. % list - an Nx2 list of pairs from which the specified pair should be removed. % %Return: % new_list - The original list without ...
function [As,Cs,Ks] = SubId(s_id,N_id,N_val,r,n) % This MATLAB routine identifies matrices A_s, C_s and K_s from open-loop % wavefront sensor data s_id, N_id and N_val, the number of samples for % identification and validation, respectively. Parameter r is the upper % bound on system order n. % % Note that in the or...
function setup %setup adds all the paths required by this package rootDir = fileparts( mfilename( 'fullpath' ) ); addpath( fullfile(rootDir, 'graphCutMex_IBFS') ); addpath( fullfile(rootDir, 'preprocess') ); addpath( fullfile(rootDir, 'preprocess', 'gsc') ); addpath( fullfile(rootDir, 'data' ) ); addpath( fullfile(ro...
%% Week 1 Homework for CMPSC200 %% 2. Response parameter s of parallel circuit % a. clear all; clc; R = 200; C = 1e-6; L = 0.64; S = (1/(2*R*C)) + sqrt((1/(2*R*C))^2 - (1/(L*C))); % b. r = linspace(0,400,1000); s = (2*r*C).^-1 + sqrt(((2*r*C)).^-2 - (1/(L*C))); % naming the figure window figure('name', 'Response ...
x = (0:7)'; % Integer input %y1 = qammod(x,8,'bin'); % 16-QAM output y1 = genqammod(x,[-1-1j, -1+1j, -1-3j, -1+3j, 1-1j, 1+1j, 1-3j, 1+3j]); scatterplot(y1) text(real(y1)+0.1, imag(y1), dec2bin(x,4)) title('16-QAM-Refine, Binary Symbol Mapping') axis([-4 4 -4 4])
function Build_Figs9ABCDEF_Enolase_Plos1_CompBio_July2021 Script_DTWPathFigs_Build_AddCaption_Plos1_CompBio_July2021('7ABCDEF'); dropFromTopFigure = 32.5; xOffset = 100; figHandle = figure(1); yRange = figHandle.Children(2).YLim; text(-xOffset, yRange(1) - dropFromTopFigure, sprintf('\\fontsize{20}%...
function [K, k, f] = CONSTQ_cqkern(sr, bpo, f_min, f_max, thresh, fffWin, h) % This function calculate the kernel for the default transformation % Calculate the spectral (K) and temporal (k) kernels and a vector of f bins, % sr, the sample rate, is mandatory % The default value are: % [K, k, f] = cqkern(sr, bpo = 12, ...
function [ results, Sim_Struct_Replicated, idx_fig_Rep] = Simulation_Serial( Sim_Struct_Replicated, idx_fig_Rep, results, num_iterations, num_averages, Verbosity, RealData_Flag) for iter_num = 1 : num_iterations tic; %parfor avg_num = 1 : num_averages for avg_num = 1 : num_averages %% Est...
function displayBoundary(boundary, color, lineWidth) %DISPLAYBOUNDARY % Input % - figHandle: the figure handle % - boundary: n * 4 matrix specifying the boundary % - color: matlab color code % - lineWidth: usually set to 3 % % Modified code from Jean-Francois Lalonde % convert to boundary cell array boundary...
for i=1:num_nodes, if tree(i).x>1.3, tree(i).x=1.3 ; end if tree(i).x<-0.3, tree(i).x=-0.3; end if tree(i).y>1.3, tree(i).y=1.3 ;end if tree(i).y<-0.3, tree(i).y=-0.3; end end for i=1:num_nodes, vx(i) = tree(i).x ; vy(i) = tree(i).y ; end figure(2) [vxp, vyp] = vorono...
fabric = imread('001bin.jpg');%reading the cropped rgb image figure(1), imshow(fabric), title('fabric'); load regioncoordinates; nColors = 6; sample_regions = false([size(fabric,1) size(fabric,2) nColors]); for count = 1:nColors sample_regions(:,:,count) = roipoly(fabric,region_coordinates(:,1,count),... ...
function points = fill_in_using_spline(points) % points = fill_in_using_spline(points) % % Use a spline to fill in the missing points (those with value <=0), % as returned by label_sequence.m % T = size(points,2); bad = find(points(1,:) <= 0 | points(2,:) <= 0); good = setdiff(1:T, bad); % spline does interpolation p...
% % function InsertAsPiecewiseConstant( tSignal, fValue, fTime ) % % insert 2 values: one at the specified time, that MUST be greater than the % last one inserted, and one immediately before (1 second) so that the % corresponding signal will be piecewise constant % function InsertAsPiecewiseConstant( tSignal, fValue...
function varargout=addmix(ConcSteps, ColSteps, Range, Primaries, ColFcn, ConcFcn) %ADDMIX Generate color test map for additive mixings. % % ADDMIX(NC,NH) generates a (2*NC-1) x 6*NH x 3 matrix with RGB values % suitable for test purposes. The distances between patches mostly have % an even distribution in La...
function [freqAngular, modalShapes] = modes_solver(nmodes, ndn, bc_disp, K, M) nd = size(K,1); realdof = 1:size(K,1); %% retain unconstrained DOFs to restore modal shape %% displacement boundary condition if ~isempty(bc_disp) dof = (bc_disp(:,1)-1)*ndn + bc_disp(:,2); realdof(dof(:,1)...
lambdy = [0.7, 1, 1.3]; n = 1000; for i=1:length(lambdy) lambda = lambdy(i) % metoda 1 (Generowanie przez funkcje odwrotna), s^(-1)(x) = x^2 % gestosc teoretyczna: f(x) = lambda * (1/(2*sqrt(x))) * exp(-lambda*sqrt(x)) metoda = 1 tic; probki = metoda_1(lambdy(i), n); toc [~...
function [Z_MIP, phi_MIP] = MIP_search( X, params, options) %----------------------------------------------------------------------- % FUNCTION: MIP_search.m % PURPOSE: Find the Minimum Information Partition (MIP) from time series % data X % % INPUTS: % X: time series data in the form (units X time) % % ...
function bg_hom3dex_alpha() % Precalculates DEER background reduction factor alpha(d) % See % Kattnig et al % J.Phys. Chem. B, 117, 16542 (2013) % https://doi.org/10.1021/jp408338q % The background reduction factor alpha(d) is defined in Eq.(18) % For large d, one can use the limiting expression % alpha = ...