text
stringlengths
8
6.12M
clear all syms x y f(x,y) = ((abs(x-1))^3 + 8*(abs(y-0.5)^3))^(1/3.0) g(x,y) = (abs(x+1)^3 + 8*(abs(y+0.5))^3)^(1/3.0) hold on for n=1:10 ezplot(f == n) ezplot(g == n) end ezplot(f == g)
function [Profit] = ThreeMachineTwoBufferTemp(Time) %TwoMOneB 三个机器两个缓冲区在一定时间的理想状态下的收益 %可修改保存前一次的矩阵来减少运算量 %Profit利润 TransMat=cell(1,3);%运转时的状态转移矩阵 TransMat{1}=[0.7 0.15 0.1 0.05;%设备1从1转到1,2,3,4状态的概率,4为彻底坏 0 0.7 0.2 0.1; 0 0 0.6 0.4; 0 0 0 1;]; TransMat{2}=[0.65 0.2 0.1 0.05;%设备2 0 0.55 0.3 0....
classdef Observateur %Observateur Classe qui permet de representer l observateur properties Position, n %indice de refraction dans lequel l observateur se trouve end methods function obj = Observateur(pos, indice) obj.Position = pos; obj.n = indice; ...
%% Math 566 (Fall 2014) %% Network from AMO Figure 2.13, page 32 data=[1 1 2 25 30 2 1 3 35 50 3 2 4 15 40 4 3 2 45 10 5 4 3 15 30 6 4 5 45 60 7 5 3 25 20 8 5 4 35 50 ]; % data=data(3:end,:) T=data(:,2); H=data(:,3); m=length(T); #edge n=max(max(T), max(H)); #node...
function [p,iter]=bisection(f,a,b,tol) % MA 3257 / CS 4032 (C-Term 2019) % Vandana Anand % % Function to use bisection method to approximate the solution to % non-linear system of equations Ax = b % % Input: f = function to evaluate % a = first interval bound % b = second interval bound % % Out...
function [msec, seg_sqn, seg_par,angles] = bbcoordgetirc( robot ) %BBGETIRC Query current joint positions in IRC units for coordinate joints. % % angles = bbgetirc( robot ) % % Input: % robot .. robot control structure % % Output: % angles .. joint coordinates in IRC units for all axes. % msec .. ...
function DTW_Coef = aa_dtw(D) % function [DTW_Coef, dtw_matrix] = aa_dtw(D) % testavimo versija % AA_DTW Create a matrix for speech recognition using Marcinkonis fast DTW % % Input: % D is a distance matrix % % Output: % DTW_Coef is the coefici...
alldata = load('alldata.mat'); i = 9; alldataPlot(alldata.alldata(i)) function alldataPlot(alldata) data = alldata.mat; for i = 1:size(data,1) Xs = data(i,1:3:size(data,2)); Ys = data(i,2:3:size(data,2)); refreshdata scatter(Xs,1000-Ys); xlim([0 2000]); ylim([0...
function [option, para] = iniMVMC( ) % ------------------------------------------------------------------------- % Initialization of the options and parameters. % ------------------------------------------------------------------------- option.verbose = 2; % --------------------------------------------------- % Choosi...
%% plot neuron spikes / avg spike shape / ISI histogram function drawNeuronStat(data, shapes, N, S, numT, mnn, mxx, R, F) % data is input from readtank % shapes is input from spikeshapes % N is neuron % S is sort % numT is which trials to draw % mnn is min range time % mxx is max range time % reinf is how far past mxx ...
function [ Xout,Fdist,Tout] = runge_kuttaG(Fode, X,T,h) k1=Fode(X,T); k2=Fode(X+k1*h/2,T+h/2); k3=Fode(X+k2*h/2,T+h/2); k4=Fode(X+k3*h,T+h/2); Xout=X+(h/6)*(k1+2*k2+2*k3+k4); Xout(7,:)=X(7,:); Tout=T+h; Fdist=0; end
% This subroutine carries out the fatten operation that it is needed to compute a safe set. function set_plus_control=fatten(N,grid_points_base, boundary_index,indexes_control) [filas_frontera,columnas_frontera]=size(boundary_index); [filas_indexes_control,columnas_indexes_control]=size(indexes_control...
function new_minSupport = NewAnswer(Time,count) %% 输入,表示扰动函数 % minSupport: 当前支持度 %% 输出 % new_minSupport: 新的最小支持度 % s=0.005; % new_minSupport=rand(1,1)*(minSupport-s)+(1-rand(1,1))*(minSupport+s); step=(1-0.001)/Time; new_minSupport=0.001+count*step;
function [info, tracks, nextId] = createNewTracks(info, tracks, ... unassignedDetections, centroids, bboxes, nextId) centroids = centroids(unassignedDetections, :); bboxes = bboxes(unassignedDetections, :); for i = 1:size(centroids, 1) centroid = centroids(i,:); bbox ...
%% process_surveys.m % % Loads and runs a script file, and saves the results in output file % %% Help % % *USE* % % TODO: write longer description of function % % *INPUT VARIABLES* % % * |input_variable_1|: TODO: write description and info on variable % % *OUTPUT VARIABLES* % % * |output_variable_1|: TODO: write descri...
%This script calculate the size of files and plot the distribution %further it calculate the overall redaction persentage in size % Amjad Yousef Majid % Reference: [1] "Will Dynamic Spectrum Access Drain my % Battery?", submitted for publication, July 2014 % Code development: % Last update: 29 Dec 2014 ...
function [alpha,ori]=get_absorption(trans_obj,idx_r) arguments trans_obj transceiver_cl idx_r {mustBeNumeric}=[] end if isempty(idx_r) alpha=trans_obj.Alpha; else alpha=trans_obj.Alpha(idx_r); end ori=trans_obj.Alpha_ori; if isempty(alpha) trans_obj.set_absorption([]); if isempty(idx_r) ...
% Convolutional reverb - Offline % T. Hueber - CNRS/GIPSA-lab %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all; close all; % read the sample waveform filename='./MG_list1_sent381.wav'; [x,Fs] = audioread(filename); i = 0; x = x(1:258*512); X = reshape(x, [], 258); % read the impulse response waveform file...
function learn_codebook(img_dir, codebook_path, para) database = retr_database_dir(img_dir, '*_feat.mat'); N = length(database.path); ri = randperm(N); M = N; feats_sc = cell( 1, M ); for n = 1:M fprintf('Loading shape context features: %d of %d\n', n, M ); load(database.path{r...
%simple code for first section: set up adjacency matrix for books, check %eigenvectors adj = [0 0 0 1 1 1; 0 0 1 0 1 1; 0 0 0 1 0 1; 0 0 0 0 1 0; 1 1 0 1 0 0; 0 1 1 0 0 0] [V,D] = eigs(adj,1)
% Function to join in vivo regression table with fixed TF fields % add_tf_fields(regression_set,tf_data,ap_shift) function reg_set_out = add_tf_fields(table,tf_data,ap_field_eve2) reg_set_out = table; % extract useful fields ap_vec = tf_data(1).ap_vec; InterpGrid = tf_data(1).InterpGrid; ap_shift = table.AP(1)-table...
function imwrite_gif(S,filename,varargin) % IMWRITE_GIF Bootstrap `imwrite` to write an animated gif to a file given a % sequence of images. % % Inputs: % S h by w by c by #frames sequence of color images % filename path to .gif file % % Example: % % Read an animation % [X,M] = imread('pe...
function idx = findEClass( eClasses, ids ) %FINDECLASS Find a list of IDs in a list of equivalence classes. % INPUT eClasses: [Nx1] cell array of integer arrays. % ids: [Nx1] int array of ids. % OUTPUT idx: [Nx1] int array of linear indices for the eClass of the % corresponding id. % % see also Seg.Glob...
%% DEMO_FEBio_cube_multi_generation % Below is a demonstration for: % 1) The creation of an FEBio model whereby multigeration materials are used to create a preload affect. % 2) A cube is loaded in tension and relaxed back while in the deformed % state the multigeneration material's stiffness is "switched on" ...
function cursorStim() fh = figure('units','normalized',... 'position',[0.1 0.1 0.8 0.8],... 'windowscrollwheelfcn',@wheelCallback,... 'keypressfcn',@keyFcn); axData = []; ax = axes('parent',fh,... 'units','normalized',... ...
clear;clc; dt=0.01; T=1; n=10; t = (0:dt:(T*n-dt)); yt = (square(2*pi.*t./T, 50)+1)./2; %yt=sin(t); subplot(2,1,1);plot(t,yt) [an, bn, fn] = DFT_(yt, t); [ifyt] = iDFT_(an, bn); hold on;plot(t,real(ifyt)) subplot(2,1,2);plot(t,(yt-real(ifyt)));
function refSig = REFSIG(freq, harmonic, timePoint, samplingRate) % return an reference signal with same number of channel, depend on the % type of reference signal, the number of channel and frequency of % reference signal might need to be specified % refSig = REFSIG(freq, harmonic, timePoint, samplingRate); %...
% Covariance Function Abstract Class % All noise function classes must inherent from this class. classdef CovFunc < tacopig.taco methods (Abstract) % Automatically report hyperparameter dimensionality % % n_theta = GP.covfn.npar(D); % % Gp.CovFn is an instan...
close all; clear all; addpath('LFW_image'); addpath('libsvm_matlab'); addpath('Politic_image'); load('LFW_meta.mat') %calculate the number of training samples and testing samples count_train = 0; count_test = 0; for i = 1 : 3795 if is_train(i,1) count_train = count_train + 1; else count_test ...
function image = FindMostBlackPixForCheckResult(directory) cd(directory); fileDat =dir(fullfile(directory,'*.jpeg')); numFile = size(fileDat,1); pixNum =zeros(numFile,1); picTemp = cell(numFile,1); tNumImage = 1; for i = 1:numFile fileName = fileDat(i,1).name; im=imread(file...
clc clear disp 'numerov method for finding zero of function' k=1; dk=0.5; tol=1e-08; phim=0; phiz=0.01; phipold=funcnuv(k,phiz,phim); for i=1:90 phip=funcnuv(k,phiz,phim); phim=phiz; phiz=phip; k=k+dk; if(phipold*phip<0) ...
function quotient_img=NQI_adaptive(img) %------Neighborhood Quotient Image------% %------input img must is a gray image------% temp_img=double(img); temp_img=normalize(temp_img); temp_img=filter2(fspecial('average',3),temp_img); for i=2:size(temp_img,1)-1 for j=2:size(temp_img,2)-1 round=[ temp_img(i-1,j-...
function [newx,maxDrat,nset]=a_addnodes3(x,D,minh,maxrD,Dth) nset=0; n=length(x); Dll=D(1:n-2); Drr=D(2:n-1); hll=x(2:n-1)-x(1:n-2); hrr=x(3:n)-x(2:n-1); maxrD=sqrt(2); r1=max(abs(Drr./Dll)); r2=max(abs(Dll./Drr)); maxDrat=max(r1,r2); for ii=2:n-1 Dl=Dll(ii-1); Dr=Drr(ii-1); hl=hll(ii-1); hr=hrr(ii-1);...
% a) % Pentru a avea sens inmultirea a*b, lungimea vectorului b trebuie sa fie % egala cu lungimea vectorului a a = [0:0.1:2] b = ones(21,1) c = a*b % b) d = b*a % c) e = a.*b' f = b.*a'
% David Krause, david.krause@ece.queensu.ca % Queen's University % July 4, 2006 % Create a two axes plot % Clean up! close all clear all clc % Some plot data x_bottom = [0, 1, 2, 3, 4] * 1e-10; x_top = [-4, -2, -1, 0, 1] * 1e9; y_left = [0.5, 0.6, 0.3, -0.1, -0.2] * 1e9; y_right = [0, 4, -5, 5, 6] * 1e4...
%% Housekeeping addpath('ximu_matlab_library'); % include x-IMU MATLAB library addpath('quaternion_library'); % include quatenrion library close all; % close all figures clear; % clear all variables clc; % clear the command terminal %% Import dat...
function y = wavelift(x, nlevel, wname) %WAVELIFT: Multi-level discrete two-dimension wavelet transform %based on lifting method. % % c = wavelift(x, nlevel, wname) performs the follows according to the % value of nlevel: % nlevel > 0: decomposes 2-dimension matrix x up to nlevel level; % nlevel < 0: do...
function [delta] = Esti_resize_fact(I, verbose) % % compute delta feature as described in the paper % M. Kirchner and T. Gloe, “On resampling detection in re-compressed % images,” in First IEEE International Workshop on Information Forensics % and Security, 2009, December 2009, pp. 21–25. % % I: Y component of J...
%%%% To compile, you need to install the mex toolboxes (I think) %%%% The command is "mex -output Lotka_Volterra_gmam_mex gmam.c Lotka_Volterra.c Lotka_Volterra_gmam_mex.c" %% Model parameters alpha = 4.0; beta = 1.0; delta = 0.5; gamma = 2.5; rho = 0.2; pars = [alpha, beta, delta, gamma, rho]; %% fixed points xfp = ...
function [u, v] = getVelocities(p, Ah) uh = 1/(p.alpha*p.f0)*( p.sigma*p.KK.*Ah + 1i*p.f0*p.LL.*Ah ); vh = 1/(p.alpha*p.f0)*( p.sigma*p.LL.*Ah - 1i*p.f0*p.KK.*Ah ); u = ifft2(uh); u = real(u + conj(u)); v = ifft2(vh); v = real(v + conj(v)); end
function [cleanData, X_data, y_data] = PreProcessData (rawData, catColumns, targetCol) fprintf("Preprocessing data...\n"); % convert categorical columns to categorical data type cleanData = convertvars(rawData, catColumns, 'categorical'); cleanData = convertvars(cleanData, targetCol, 'categorical'); ...
%make occupancy grid for i=1:size(Landmark_Groundtruth,1) xL = Landmark_Groundtruth(i, 2); yL = Landmark_Groundtruth(i,3); obsY_ind = find(xRange < xL, 1, 'last' ); obsX_ind = length(yValues) - find(yRange < yL, 1, 'last' ) + 1; for j=obsX_ind-3:obsX_ind+3 for k=obsY_ind-3:obsY_ind+3 ...
function band2 A=imread('band.jpg'); tipoimagen=size(size(A)); if tipoimagen(2)==3 A=rgb2gray(A); end s=size(A); w=s(2); a=s(1); %Step 2 for j=1:a m=mean(A(j,:)); for i=1:w A(j,i)=m; end end %Step 3 level = graythresh(A); ...
%% FINITE LAYER ANALYSIS % getSteelLayers.m % 3 Mar 2015 % Trent Taylor function [ layers ] = getSteelLayers(defaultSteelGrade) %GETSTEELLAYERS Assembles a struct of concrete layers %% Get number of layers layerCount = inputdlg('Input number of layers: '); if (str2num(layerCount{1}) == 0) layers = {}; retur...
%% To compute the adsorbed values in different formats clear all close all clc format long %% Flags mrdf = 0; m3 = 0; m4 = 0; m5 = 0; m6 = 0; mads = 1; %% Inputs nmonfree = 30; nmongraft = 30; ngraft = 64; nfreearr = [16;32;48;64;80;100;150]; cutoff = 0.9; lz = 120; area=53^2; rhofree = nfreearr*30/(lz*area); gr...
% Script generated by Brainstorm (24-Feb-2019) ProtocolName = 'Leadfield_MNI'; % Delete existing protocol gui_brainstorm('DeleteProtocol', ProtocolName); % Create new protocol gui_brainstorm('CreateProtocol', ProtocolName, 0, 0); % Input files sFiles = []; SubjectNames = {... 'MC0000010'}; RawFiles = {... 'F:\...
%all use trapezoid method %q1 h=10e-6; num=(4-0)./h; ans = 0; low = 0; high = 0 + h; for i=1:num mid = (prob2_func1(high) + prob2_func1(low)).*h./2; ans = ans + mid; low = low + h; high = high + h; end fprintf(1,'(i) %.8f + %.8f i\n',real(ans),imag(ans)); %q2 num=(pi-0)./h; ans = 0; low = 0; high = 0 + ...
function [mob]=a_ctmob(N,umin,umax,Nref,b) mob=umin+(umax-umin)./(1+(N./Nref).^b);
function getFileUpdate( MinGenes,MinChips,MaxBicluster,MaxOverlap ) s=struct('size',{},'genes',{},'chips',{}); [filename, pathname, filterindex] = uigetfile('*.txt', 'Pick an Input-file'); %s = textread(filename,'%s','delimiter','\t| |,'); %s(1) %s(2) count=1; fid = fopen(filename); tline = fgetl(fid); wh...
function display_TS_range_pdf_cback(~,~) esp3_obj=getappdata(groot,'esp3_obj'); update_survey_opts(esp3_obj.main_figure); layer_obj=get_current_layer(); if isempty(layer_obj) return; end curr_disp=get_esp3_prop('curr_disp'); trans_obj=layer_obj.get_trans(curr_disp); survey_options_obj=layer_obj.get_survey_opt...
function [m_632p,CI,m_list] = kyu_632plusbootstrap(m_trn,m_test,gamma) % calculate 632+ bootstrap estimate of a performance index % input: % m_trn: performance metric of a model trained/tested in the entire data (a single value) % m_test: (Nx1) vector of out-of-bag performance from N bootstrap samples % gamma: no-info...
function [stddevs] = intan_exp_check(path,exps) % % % % % % % % expinfo = struct(); for i = 1:length(exps), ds = dirstruct([path filesep exps{i}]); tdirs = getalltests(ds); numtdirs = length(tdirs); stddevs = struct(); % 32 channels, 8 time points. for j = 1:numtdirs, ...
function y=foo(x) a=sin(x); x=x+1; b=sin(x); y=a.*b;
% function testCombinationThreshold %% Setup paths and load databases addpath ../; setPath; basePath = '/nfs/hn01/jlalonde/results/colorStatistics'; outputBasePath = '/nfs/hn01/jlalonde/status/colorStatistics'; compiledResultsPath = fullfile(basePath, 'matchingEvaluation', 'compiledResults'); measuresCombinationPath ...
% THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION IS RELEASED "AS IS." THE U.S. GOVERNMENT MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, CONCERNING THIS SOFTWARE AND ANY ACCOMPANYING DOCUMENTATION, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT ...
clear variables; n=2; %Wave function order L=10e-9; %Box width psi = @(x) sqrt(2/L)*sin((n*pi*x)/L); %Possible wavefunctions equation density = @(x) (sqrt(2/L)*sin((n*pi*x)/L)).^2; %Probability density flipdensity = @(x) -((sqrt(2/L)*sin((n*pi*x)/L)).^2); %Probability density flipped x=linspace(0,L,500); %...
function [ o ] = objfunc( x ) %OBJFUNC define the optimal objective functions % use 'persistent' to define variables to avoid repeated calculation persistent cnt pf Sn DG % Snew if isempty(cnt) cnt = 1; data33 = busdata33; pf = PowerFlowRadia(data33); % initialize pf.makeYbus(); pf.makeS...
clear all; Nx = 50; xline = linspace(-1,1,Nx); %A = -FEFractionalLaplacian(0.5,1,Nx); A = FDLaplacian(xline); a = -0.5; b = +0.5; B = BInterior(xline,a,b); %% % Number of degree of fredom of matrix A is: N^2 % Number of degree of fredom of matrix B is: N^2 % Total Numer of unknowns quatities; 2N^2 %% % For this reaso...
% different cuts (subplots) for each measure (figure) for matc=1:num_sel_measures figure(2000+matc); clf; hold on set(gcf,'Position',[5 39 1912 1072]) subplot('position',[0.075 0.55+(num_frame_select>3)*0.15 0.85 0.4-(num_frame_select>3)*0.15]) xlim([s_para.itmin-0.02*itrange s_para....
function [T,Y] = integratorThreeP2X7ASym(ton,toff,Ttot,amp,dt,y0) global a b ra rb g12 E12; %#codegen T=(0:dt:Ttot).'; nT=floor(Ttot)/dt; Y=zeros(nT,1); Y(1,:)=y0; for j=1:nT-1 A=amp*(heavi(T(j)-ton)-heavi(T(j)-toff)); Y(j+1,1)=(Y(j,1)+dt*())/(1+dt*());%O1 end end
function [ bets, type, max_odd ] = bet( Odds, prob, bettable_money, ... strategy_enabled, tresh ) % function to assess wheather to bet and in that case check p > 1/o and % calculate betsize % output: betsize and type ( m x 2 ) % bets : size of bet placed % type : 123 (HDA) [m, n] = size(Odd...
%% clear; clc; close all; %% s2pfile_A = 'tline_LC_ckt.s2p'; s2pfile_B = 'CapInShunt_ckt.s2p'; %% % Read in a .s2p file, s2pfile_A, and model as a pi model. % First, plot its S-parameters. % Make sure to set the Matlab path first before running this script. % % An s2p file gives, for every freq, the S11 S21 S12 &...
function p = qacos(q) % arccosine of qauternion q d = pqnorm(q(2:4)); if d == 0 p =[real(acos(q(1))) imag(acos(q(1))) 0 0]; else n = [0 q(2:4)]/d; p = qmul(-n, qacosh(q)); end
function [LCL] = cloudbaseplot(sounding,snum,plotornot,display) %%cloudbaseplot %Function to estimate and plot cloud base in height coordinates. % %General form: [LCL] = cloudbaseplot(sounding,snum,plotornot,display) % %Output: %LCL: estimated height of cloud base in km % %Inputs: %s...
% NODDI matlab toolbox processing % Tutorial: http://mig.cs.ucl.ac.uk/index.php?n=Tutorial.NODDImatlab %%% MRST DATA processing restoredefaultpath clearvars clc %%%%%%%%%%% PART TO CHANGE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% addpath(genpath('/data/user/rodolphe/Toolbox/NODDI/NODDI_toolbox_v1.04/')); ad...
function updateSprite(sprite, posX, posY) sprite.Position = [posX posY]; end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2012 Analog Devices, Inc. % % Licensed under the Apache License, Version 2.0 (the "License"); % you may not use this file except in compliance with the License. % You may obtain a copy of the License at % % http:/...
close all % Task 1 PSD [pxx, w] = periodogram(N1_50, [], 512, Fs); subplot(4, 1, 1) semilogy(w, pxx) title('N = 1, f_{cut} = 50Hz') xlabel('frequency') ylabel('PSD/dB') [pxx, w] = periodogram(N2_50, [], 512, Fs); subplot(4, 1, 2) semilogy(w, pxx) title('N = 2, f_{cut} = 50Hz') xlabel('frequency') ylabel('PSD/dB') [p...
% DEMINTERSPEECHTALK Show demos for Interspeech talk in order. % DIMRED colordef white disp('Ready ... Projection of Grid onto eigenvectors.') disp('demProjectVoices;') r = input('Type ''R'' to run or ''S'' to skip: ', 's'); switch r case {'r', 'R'} close all clear all % Load the results and display dyna...
function [ pupil,mask] = pupilWFE(rays, rmttp) %pupilWFE pupilWFE(rays) returns a pupil-referred optical path difference % rmttp is whether to remove the Tip/Tilt/Piston (defaults to false) % false means it removes the chief ray OPL only. %map % % opl = rays.opl(rays.valid); % if isfield(rays,'chief') && rays.v...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [fdobj, ncoefs, lik, proc] = ... Smooth_LS(fn, times, data, coefs, pars, basisvals, lambda, ... fdobj, more, obsweights, quadrature, ... in_method, options_in, diffeps, poslik, posproc, discrete, ... ...
%*********************************************************************** % 1-D FDTD code with simple radiation boundary conditions %*********************************************************************** % % Program author: Susan C. Hagness % Department of Electrical and Computer Engineering...
function xs = gibbsMetrop(logpost, start, nsamples, scale, args) % Gibbs sampling where we sample from each full conditional using Metropolis Hastings % We assume the proposal is Gaussian(0, diag(scale)) % Returns xs(s, i) for s=1:nsamples, i=1:ndims % Based on code by Johnson and Albert p = length(start); if nargin<3...
% test for function deri clc;clear ALL;close all; %[t,x]=ode45(@(t,x)Quaterror(x),[0 10],[0.8224 0.2226 0.4397 0.3604 14 0.8 0.74 1 10 3 2 1 15])% work perfect %[t,x]=ode45(@(t,x)test2(x),[0 10],[-0.2226 -0.8224 -0.3604 -0.4397 4 0.8 0.74 1 4 3 2 1 5]) %[t,x]=ode45(@(t,x)test2(x),[0 10],[0.289954 -0.841122 -0.04328...
function dx = PopAlleeODE(t,x,bmax,do,d1,K,A,tau,sigma,Eend,eps) % This function includes the ODE of a population subjected to an Allee % effect. The ODE has 3 equations: % dx(1) --> population density % dx(2) --> mean trait % dx(3) --> environmental stress dx=zeros(3,1); N=x(1,1); xmean=x(2,1); E=...
% [alpha,beta,theta,Ms]=numeric_solution_2(90,4,1.5,110,150,17.9,16.35) % vin,Is1,Is2,Vout in rms value % f in kHz % M1 and M2 microHenry function [alpha,beta,theta,Ms]=numeric_solution_2(Vin,Is1,Is2,Vout,f,M1,M2) w=2*pi*f*1e3; M1=M1*1e-6; M2=M2*1e-6; Vin=Vin*sqrt(2); Is1=Is1*sqrt(2); ...
function [core_vert,crst,cr_vol,P,Pc]=CddCoreSimplexVertices(v,tol) % CDDCORESIMPLEXVERTICES computes all core vertices of game v, % whenever the core exits. Projection method is simplex. % The cdd-library by Komei Fukuda is needed. % It is recommended to install the cdd-library that accompanies % the Multi-Parametri...
function movieArray = ImportVideo(data, varargin) % This function imports a video into Matlab and makes it into a 3d array. % Possible varargin include 'startFrame' and 'endFrame', allowing the user % to choose the first and last frames to upload. Used portions of a code % from the website % http://www.matlabtips.com/h...
clear;%geometric operations Image=rgb2gray(imread('android.jpg')); imshow(Image); img1=affine2d([4 0 0;0 1 0;0 0 1]);%scaling(shrink) img2=affine2d([0.3 0 0;0 1 0;0 0 1]);%scaling(stretch) img3=affine2d([-1 0 0;0 1 0;0 0 1]);%flipping(horizontal) img4=affine2d([1 0 0;0 -1 0;0 0 1]);%flipping(vertical) img5=affine2d([-1...
% inhomogeneity correction in histology img=imread('PANO_HIGHRES.png'); img2=imopen(img,strel('disk',15)); imshow(img2);
clc; clear; close all pkg load image A = imread('files/peppers.jpg'); subplot(2, 2, 1) imshow(A) title('Imagen Original') % Forma 1 de calcular el histograma h1 = zeros(256, 1); %h1 = [h(0) h(1) ... h(255)] [m, n] = size(A); tic for x = 1:m for y = 1:n h1(A(x,y)+1) += 1; endfor endfor t1 = toc subplot(2, 2,...
function shmDataSimulated(x0, springConstant, noiseFactor, outFileName) % Generate simulated pendulum data % Copyright 2008-2009 The MathWorks, Inc. % $Revision: 35 $ $Date: 2009-05-29 15:27:34 +0100 (Fri, 29 May 2009) $ if nargin<4 outFileName = 'shmData.xls'; end mass = 1; % kg % Determine...
function plot_graph(fp, obj, opt_type) res = csvread(fp); jsd = sort(res(:,1)); ks = sort(res(:, 2)); r2 = sort(res(:, 3)); end
%j = 3; %n = 2^(2*j); j = 9; n = 81; %Nang = 33; Nang = 36; angles = [0:(Nang-1)]*360/Nang; %tmp = radon(zeros(2^j, 2^j), angles); tmp = radon(zeros(j, j), angles); k = length(tmp(:)); %disp(length(angles(:))); A = sparse(k, n); k n %disp(length(A)) for iii = 1:n %unitvec = zeros(2^j, 2^j); ...
function BaiTap014() imgTrainAll = loadMNISTImages('./train-images.idx3-ubyte'); lblTrainAll = loadMNISTLabels('./train-labels.idx1-ubyte'); imgI1D = imgTrainAll(:,1); imgI2D = reshape(imgI1D,28,28); featuresVector=extractHOGFeatures(imgI2D); nSize=length(featuresVector); nTrainData=size(imgTrainAll,...
function simData = uvsd_gen_sim_data(pars,nTarg,nLure,nSamples,ignoreConds,rngSeed) % usage: % simData = uvsd_gen_sim_data(pars,nTarg,nLure,nSamples) % % UVSD_GEN_SIM_DATA generates random data sets from the UVSD model using a % bootstrap procedure. % % Required Input: % pars - A MxN matrix of memory strength (d'...
% ODE_01.m clear close all clc tMin = 0; tMax = 1; tSpan = [tMin tMax]; y0 = [1]; K = 0.0847; [t,sol] = ode45(@(t,y) FNT(t,y,K),tSpan,[y0]); T = sol(:,1); %dTdt = sol(:,2); figure(1) xP = t; yP = T; plot(xP,yP) grid on; box on xlabel('t') ylabel('y') set(gca,'FontSize',12) ...
function results = run_model(theta, fit_data, Voc_data, Qnom, SOC0) % This function runs the simulink model for system identification, % which is designed to be used with HPPC input data. % Assign current iteration values to circuit components R0 = theta(1); R1 = theta(2); C1 = theta(3); ...
function [Projected_image] = projectiveTransform(I , ref) % Input % I - Input image % R - Reference image % Output % O - Output Image %% Function starts from here % coordinates of input and reference image figure imshow(I), title('Input Image'); [a,b] = ginput(4); figure imshow(ref), title(...
classdef (Abstract) memristor_array < handle % The purpose of this is just to be able to test identical training % protocols on real and simulated arrays. % Additionally, could be applied to simulations of various styles, or % various types of memristors, etc properties (Abstract) net_s...
function newSpec = addGaussbroaden( spec,method,a,b,c ) % 为能谱增加高斯展宽 % % INPUTS: % spec: 双列能谱,第一列MeV能量,第二列计数 % method:1.平滑展宽 2.抽样(要求spec第二列为自然数) % a,b,c: parameters in FWHM=a+b*sqrt(E+cE^2) % 林谦老师ppt推荐NaI:a=0.01 b=0.05 c=0.4 % % OUTPUS: % newspec: 第一列MeV能量,第二列计数 newSpec = [spec(:,1),zeros(size(spec,1),1)]; energ...
%% load_files_from_survey_input.m % % TODO: write short description of function % %% Help % % *USE* % % TODO: write longer description of function % % *INPUT VARIABLES* % % * |surv_input_obj|: TODO: write description and info on variable % * |layers|: TODO: write description and info on variable % * |origin|: TODO: wri...
function dq = rot2dq(theta,axis) % ROT2DQ constructs a rotation dual quaternion (theta in [deg]!) % % DQ = ROT2DQ(THETA,AXIS) returns the dual quaternion DQ which is the % dual quaternion representation of a rotation of angle THETA and of % axis AXIS. % - THETA represents the rotation an...
function [ TestError_logcond, TestError_numpar ] = AlgStable(alg, crit, ... objects, features, parameters) % Function returns the pair test error, logarithm of the condition number and % the pair test error, number of the selected features for every FSM and % values of the ...
%@(#) ekonomi.m 1.10 06/03/24 10:09:46 % function varargout = ekonomi(varargin) % EKONOMI M-file for ekonomi.fig % EKONOMI, by itself, creates a new EKONOMI or raises the existing % singleton*. % % H = EKONOMI returns the handle to a new EKONOMI or the handle to % the existing singleton*. % %...
function O = bone_offsets(C,P) % BONE_OFFSETS given a list of joint positions and parent indices compute % for each joint an offset based on the parent's position (roots will be % offset by origin) % % O = bone_offsets(C,P) % O = bone_offsets(C,BE) % % Inputs: % C #C by dim list of joint positions...
function linearODESSEfullP2X7Therm(T,I) global K1 k1 K2 k3 K3 k5 Ks3 k7 Ks2 k9 Ks1 k11 L1 Ks L3 H1 H2 H3 H4 H5 Kds H7 g12 g34 E12 E34 A V alpha10 alpha1 alpha3 alpha32 alpha100 alpha k2 k4 k6 L2 k8 k10 k12 H6 Acell p0 err Q; %#codegen generatorMatrixfullP2X7Therm(); Nt=length(T); for i=1:Nt p0=p0*expm(Q*T(i...
% RC_CircuitSim % Function to simulate the transient response of an RC circuit function [timeArray, VoutArray] = RC_CircuitSim( ... Rm, Ro, C, VmArray, Vinit) % initial conditions VoutInit = (Vinit*Ro) / (Ro+Rm); % time increment deltaT = 1e-9; for tIndex = 1:length(VmArray) if tIndex==1 prevVou...
figure(5);clf; %=====open a serial connection=============================== %set its rate to 115200 baud %terminator character is (ACSII 13) which is <cr> or <enter> %use fscanf(s, format) to read the port % delete any open ports left by % incorrectly terminated programs fclose(instrfind) % define the ...
function [inputs,kerr]=a_rdev(p,inputs) global A_FID ip=a_init_dev; [ip,kerr]=a_diktat(p,ip,A_FID); inputs.device.ip=ip;