text
stringlengths
8
6.12M
% atmPendulum.m % % DOING PHYSICS WITH MATLAB % https://d-arora.github.io/Doing-Physics-With-Matlab/ % IAN COOPER % matlabvisualphysics@gmail.com % LINK: DOWNLOAD MATLAB SCRIPTS % https://github.com/D-Arora/Doing-Physics-With-Matlab/tree/master/mpScripts % https://drive.google.com/drive/u/3/folders...
function primeArray = findprime( n ) %UNTITLED7 Summary of this function goes here % Detailed explanation goes here count =0; i=2; primeArray =[]; while(count<n) if(isprime(i)==1) count=count+1; primeArray=[primeArray,i]; end i=i+1; end end
function do_nothing(~,~,~,~) end
zi=-10; xi=-10; zf=10; xf=10; zstepfrac=0.1; xstepfrac=0.1; size=int32(((zf-zi)/(zstepfrac)+1)); eta = 3; thetai='0.25pi'; g=[1.0]; for x=1:1 g(x) = round(g(x)*10^1)/(10^1); end sizesquare=int32(double(size)*double(size)); data=zeros(sizesquare, 6, 7); for x=1:1 num2str(g(x), '%3.1f'); data(:,:,x) = load(strcat('d...
function [xyzStairPlane, stairsEdges] = fitPlaneFromPrediction(xyzPoints, uvdPoints, edgeCandidates,predictedPlane,uvdGP,epsilon) global intrinsics baseline; xyzStairPlane=[]; stairsEdges=[]; predictedPlaneuvd=uvdPlane2(predictedPlane, intrinsics, baseline); predictedPlaneuvd=uvdPlaneExpand(predictedPlaneuvd); %rewri...
% File: SA2_7.m for Study-aid Example SA2-7 clear; % Calculate the PSD for periodic e^t using the FFT. M = 6; N = 2^M; n = 0:1:N-1; T = 1.0; dt = T/N; t = n*dt; % Creating time waveform w = exp(t); % Compute the FFT data points. W = fft(w); W = W(:); % SINCE THE WAVEFORM IS PERIODIC, % USE COMPLEX FOURIE...
%建立符号变量a(发展系数)和b(灰作用量) syms a b; c = [a b]'; %原始数列 A A = [87016, 81784, 76089, 74558,81772, 74194]; n = length(A); %对原始数列 A 做累加得到数列 B B = cumsum(A); %对数列 B 做紧邻均值生成 for i = 2:n C(i) = (B(i) + B(i - 1))/2; end C(1) = []; %构造数据矩阵 B = [-C;ones(1,n-1)]; Y = A; Y(1) = []; Y = Y'; %使用最小二乘法计算参数 a(发展系数)和b(灰作用量) c = i...
function tests = specialzerosTests tests = functiontests(localfunctions); end function testBesscrosszero(testCase) BCs = ['DD'; 'DN'; 'ND'; 'NN']; for nu = [0, 1e-5, logspace(0,2,10)] for l = logspace(0,2,10) + 0.01 for i = 1:size(BCs,1) for n = 1:400 fai...
% Lab 2 Calculations % By Drew Wynne % Commenced: 27, 08, 2016 % Completed: TBA clear; close all; clc fprintf('\n\nLab 2 Calculations...\n'); %% Theoretical Mass and Moment Lab_2_Mass_Moment_Calculations; %% Angular and Linear Velocities and Accelerations Lab_2_Motion_Calculations; fprintf('La...
function [I]=int_midpoint_rule(fun,a,b,n) h = (b-a)/(n-1); xj(1) = 0; xk(1) = 0; f(1) = 0; for j=1:n xj(j) = a + (j-1)*h; end for k=1:n-1 xk(k) = (xj(k+1) + xj(k))/2; end for i=2:n f(i) = f(i-1) + h*(fun(xk(i-1))); end I = f(n); end
% ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| % INFORMATION % ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| % % Need to have run Mdn_PwrR_Split.m to use the code below. % % |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||...
% VORLAGE Numerisches Loesen von Differentialgleichungen (mit ode45) % Angelos Drossos % 19.02.1013 % GPLv2 % Tipp: Immer das komplette Skript ausfuehren (Run-Button / F5) %% Workspace loeschen, Console loeschen, alle Fenster schliessen % dient der Sicherheit / um Fehler schnell zu erkennen clc clear all c...
function ean=EANSCValue(clv) % EANSCValue computes the Equal Allocation of Non-Separable Contribution/Cost Value % % Source: Moulin, H. (1985). The separability axiom and equal-sharing methods, % Journal of Economic Theory 36(1): 120-148. % % Usage: ean=clv.EANSCValue() % % Define variables: % output: % ean ...
%Zhe Chen %Final Project for CFD %main script clear; close all; clc; addpath('./CodeReport/code/') h=2; a=0.656; mg=1.27e-15*9.8; dx=h/8; M=1; L=1024; L_ic=12*h;%32sigma kT=(h-a)*1e-6*mg; T=kT/1.38064852e-23 omega=16; S=6*a^3*omega; Amp=M/L_ic; %!!!!!!!!! R=L/2; limiter=1; eps_f=0.025*Amp; eps_a=.01; V0=Amp*pi*S/3; K...
function [Energy_information, Energy_values] = flexload_allocatoin_get_profile_energy(input_simdata, sep, input_selector, timebase, ontime) %FLEXLOAD_ALLOCATOIN_GET_PROFILE_ENERGY Summary of this function goes here % Detailed explanation goes here % retrieve the information of the simulated profiles: content = dir(i...
function blocking = blocking(erp,i) % function detects blinks in the VEM channel %thresh = erp.arf.thresh(chanc); winSize = 100; % size of test window, ms winSize = round(winSize/erp.rateAcq); % size of test window, samples winStep = 50; % size of step between windows, ms winStep = round(winStep/erp.rateAcq); ...
function output = checkInjection(frame, varargin) % Grant David Meadors % 02012-04-24 % gmeadors@umich.edu % Compares the frame file against a list of known % successful hardware injections to see whether % the feedforward algorithm alters them. % This should also detect any spurious timing shifts. % The varargin wo...
function varargout = opentoolbox(varargin) % OPENTOOLBOX MATLAB code for opentoolbox.fig % OPENTOOLBOX, by itself, creates a new OPENTOOLBOX or raises the existing % singleton*. % % H = OPENTOOLBOX returns the handle to a new OPENTOOLBOX or the handle to % the existing singleton*. % % OPENTOOLB...
function perccount(jj,maxjj) %Reports the percentage of the job done to the screen. % % PERCOUNT(I,Imax) % I is the current iteration between 1 and Imax % Imax is the maximum number of iterations % % Do not print anything to the screen between calls of this function! % % title - s cmspike/perccou...
function [h,a,w] = mplfiltl(fr,mag,wts,na) % Function to create a (linear phase) digital filter % Called by mplcalcc % Parameters [fp fs], mag, [wt1, wt2], and na from pulse setup % Returns h (b-polynomial (evaluated around the unit circle), % a (a-polynomial evaluated around the unit circle), and w (freq) global mm...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script is for training the neural network without SMOTE. % I use this script mainly for evaluating the performance of the % algorithm. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % clc; % clear; % clos...
function error=compute_Hs_error(exact_solution_fun, solution,P,T, Tb, basis_type, der_x,der_y,Gauss_type, time) error=0; number_of_elments = size(Tb,2); for n=1:number_of_elments vertices = P(:,T(:,n)); uh_local=solution(Tb(:,n)); [Gauss_coefficient_reference_triangle,Gauss_point_reference_triangle]=genera...
clear; methods = {'quad-rankmm-10.0-none-none-false', 'quad-l1mm-10.0-none-none-false', 'quad-mle-100-5.0'}; allPos = {}; allNeg = {}; allROC = {}; files = {'../../../output/citeseer.out'}; for k = 1:length(files) fin = fopen(files{k}, 'r'); while ~feof(fin) line = fgetl(fin); pattern = 'Meth...
function p = double_barrier_exit_prob(x, xprime, L, U, sigma, dt, cutoff) % DOUBLE_BARRIER_EXIT_PROB calculates the probability of a GBM reaching L or U. % % p = DOUBLE_BARRIER_EXIT_PROB(x, xprime, L, U, sigma, dt, cutoff) gives % the probability for a GBM S of hitting one of the barriers L and U over % a time pe...
function varargout = S2MT_G(varargin) % S2MT_G MATLAB code for S2MT_G.fig % S2MT_G, by itself, creates a new S2MT_G or raises the existing % singleton*. % % H = S2MT_G returns the handle to a new S2MT_G or the handle to % the existing singleton*. % % S2MT_G('CALLBACK',hObject,eventData,handles,...
clc; close all; clear all; fm=input('Enter Frequency of the message signal: '); fc=input('Enter Frequency of the carrier signal: '); fs=100*fc; t=0:1/fs:((2/fm)-(1/fs)); x=0.4*cos(2*pi*fm*t)+0.5; y=modulate(x,fc,fs,'ppm'); xrec=demod(y,fc,fs,'ppm'); subplot(2,2,1); plot(x); title('Message Signal'); subplot(2,2,2); plot...
% -------------------------------------------------------------------- % % Evaluates the first partial derivatives of the biquadratic b.f. % at point 'k' from array 'Gauss_point' % 'Gauss_point' contains the coordinates of the % reference triangle (0,0),(1,0),(0,1) % % (-1,-1),(1,1) % % Presummed ordering of the nodep...
%Convolutional neural network for handwriten digits recognition: training %and simulation. %(c)Mikhail Sirotenko, 2009. %This program implements the convolutional neural network for MNIST handwriten %digits recognition, created by Yann LeCun. CNN class allows to make your %own convolutional neural net, defining arbitra...
%For checking proplib validity %Set the GetTPX function to always make a non-DB initial guess! %Get values from the library D = load('PropLib3.dat'); T_lib = D(:,1); P_lib = D(:,2); X_lib = D(:,3); Q_lib = D(:,4); H_lib = D(:,7); %Make H error Q_err = zeros(size(H_lib)); D_new = zeros(size(D)); %Loop through and calc...
function [Performance,Thermal_Efficiency] = PerformanceEfficiencyCp(T1,P1,PR,MaxT) % Thermal Systems - Project 2A % Function to obtain performance and efficient of a jet engine with particular parameters for constant cp %%%%%% % Definition of Constants %%%%%% R=0.287; % Constant n=1.4; % Constant k = (...
M = 15; % number of measurements % projType = 1; % uniform random projection projType = 2; % Gaussian random projection % projType = 3; % Single pixel measurement %% Create random measurement matrix C = zeros(M,n*n); Theta = zeros(M,n*n); xmeas= zeros(n,n); for i=1:M xmeas = 0*xmeas; if(projType==1) ...
function rdDpxExpRotBindTwoFullCyl() %%report the front fields of both full cylinders % %%input needed: none %%i.e. rdDpxExpRotFullCyl() fb=''; pos='shuffled'; E=dpxCoreExperiment; E.txtPauseNrTrials=151; E.nRepeats=5; E.txtStart='Kijk naar het rode kruisje.\n\nWelke richting draaien de voorvlakken van beide cylinde...
function status = idlk(t,y,flag,params) global tt yy uu if nargin < 3 || isempty(flag) tt = [tt;t(end).']; yy = [yy;y(:,end).']; nu = quad_sdlqr(t(end),y(:,end),params,uu(end,:)); uu = [uu;nu.']; else switch(flag) case 'init' fprintf('start\n'); tt = t(end).'; yy = y(:,end).'; uu = [uu;params.u0.']; case ...
function [logarithmicNegativity negativity entanglementOfFormation covariance alpha beta gamma]=Covariance_negativity(covariance) sigma=4*covariance; % factor 4 because definition of quadratures is different for below formulas (vacuum variance=1) alpha=sigma(1:2,1:2); gamma=sigma(1:2,3:4); beta= sigma(3:4,3:4); Del...
% Copyright (c) 2020 Gabriele Gilardi % Perform the feed-forward step (eq. 25, Ch. 2) function NNs = FeedForward(NNs) for i = 2:length(NNs) NNs(i).Z = NNs(i).W*NNs(i-1).A + NNs(i).B; NNs(i).A = f_activation(NNs(i).Z); end % End of function
function [train_proj,test_proj] = train_test_mcml(Xtrain,Ytrain,Xtest) [mcml_model] = train_mcml(Xtrain,Ytrain); train_proj = mcml_model.Xtrain; [err,test_proj] = test_mcml(Xtest,[],mcml_model);
function So=UTIL_vectSpectAvg(Si) So=zeros(size(Si,2),1); for n=1:size(Si,1) So=So+Si(n,:)'; end So=So./size(Si,1);
clearvars; dforprojm = pwd; prompt = 'Enter the file name of the dataset '; str = input(prompt,'s'); data = load([str]); prompt = 'Enter the file name for output '; str1 = input(prompt,'s'); d = 0; drt = 0; arr = [data]; for ik = 1:10; for k = 1:10; drt = 25 + drt; d = drt; if ik==1; ext = ['a' num2str(k) ]; end; if...
%% evenlySampleCurve % Below is a basic demonstration of the features of the |evenlySampleCurve| function. %% clear; close all; clc; %% % PLOT SETTINGS fig_color='w'; fig_colordef='white'; markerSize=15; lineWidth=2; %% EXAMPLE USING NORMAL INTERPOLATION %Simulating the case of an unevenly sampled l...
clc; clear all close all t=mmreader('vishi.avi'); numframe=t.NumberOfFrames; k=1; d=read(t,1); a=size(d);m=a(1);n=a(2); for i=1:40 d=read(t,i); is=ischessboard(d); imwrite(d,char_name(90)); if (is==1) k=k+1 % am(k)=d;fr end end
function [ex0, ex2, idxs] = split_co(ex, es) %% % split ex-file with different contrast such that the effect size % corresponds to 'es' % cos = unique([ex.Trials.co]); lenc = length(cos); spks = ones(1, lenc); si = cell(1, lenc); for c = 1:lenc [spkv, spkc] = getSpks(ex.Trials([ex.Trials.co]==cos(c)), [0.8 0]); ...
function segments = mia_cmbseg(segin) % combine the segments belong to boundaries of holes inside the objects % with the segments of objects boundaries. % Authors % Sahar Zafari <sahar.zafari(at)lut(dot)fi> % % Changes % 14/11/2016 First Edition %----------------------------------------------------...
% Run a test of the Kelvin-Helmholtz instability. %--- Initialize test ---% grid = [512 512 1]; run = KelvinHelmholtzInitializer(grid); run.iterMax = 1000; run.waveHeight = .01; % Creates sine waves at the boundaries of this amplitude (as fraction of total grid) run.numWave ...
function whisking = whisking_general(array,displayOpt) % % This function outputs a general whisking analysis of: % 1) comparison of spiking based on whisking vs quiescent periods % 2) comparison of spiking in protraction vs retraction in whisking cells % 3) tuning across the population as whisking reaches the peak or ...
function Dmn = get_Dmn_from_Dx(num,D_x,m,n) load('TD_init_parameters.mat','S_dparameters'); dx = S_dparameters(num).dx; [~,CFvecs] = get_CF_basis(num); Dmn = sum(CFvecs(:,m).*D_x.*CFvecs(:,n))*dx; end
% Javier Salazar 1001144647 Set 5 Ex 3 clc clear all x1 = 10; x2 = -10; n = 50; taylor_x1 = zeros(1,n); taylor_x2 = zeros(1,n); for i=1:n taylor_x1(i) = exp_approx(x1, i); taylor_x2(i) = exp_approx(x2, i); end error_x1 = abs((exp(x1)-taylor_x1)./(exp(x1))); error_x2 = abs((exp(x2)-taylor_x2)./(exp(...
function R=fastExpm(S) %attempt to compute expm faster [V,D]=eig(S); R=V*diag(exp(diag(D)))*V'; R=real(R); end
function [s] = averageN(M) s=zeros([1,20]); for j=1:20 for i=1:30 s(1,j)=s(1,j)+M(i,j); end s(1,j)=s(1,j)/30; end plot(s) %draw the graph legend('T1','T2'); hold all %drwing all the graphs on the same axes end
function [area, contr_signal] = dir_valve_area_characterization(valve_data) % The function computes values of orifice area as a function of valve % control signal to be used in approximating equation % q = C_d * area(x) * sqrt(2/rho * p). The computation is based on the set % of experimental data provided in the ...
function [dx,dy]=getDispersion(THERING,bpmindx) % function [dx,dy]=getDispersion(THERING,bpmindx) % % determines dispersion taking two orbits at plus and minus DE=0.0001 % DE=0.001; Op=findorbit4(THERING,DE,bpmindx); Opx=Op(1,:); Opy=Op(3,:); Om=findorbit4(THERING,-DE,bpmindx); Omx=Om(1,:); Omy=Om(3,:); dx=(Opx-...
function [T,BG_data,BI_data]= sim_clin_data(N_of_subjects,CV,rsquared,auto_decay) % Generation of simulated clinical data from "acceptable" profile. % Additions for data generation by R Allen and T Rieger % This function generates the simulated data that we will attempt to match. % We generated simulated profiles b...
clear all, close all, clc load('datamat.mat') dt = parms.dt; %---get DMD modes from data matrix %Rescale X for covariance matrix: X = Xbg(:, 1 : end - 1); X2 = Xbg(:, 2:end ); [U, S, V] = svd( X, 'econ' ); %Compute DMD (Phi are eigenvectors ) r = 15; % truncate at r ; U = U(:, 1 :...
% op_bessel1.m % Bessel function of the first kind J1 % 30 aug 2014 % Ian Cooper School of Physics University of Sydney % cooper@physics.usyd.edu.au % https://d-arora.github.io/Doing-Physics-With-Matlab/ % Plot of the Bessel function of the first kind % Plots of the Fraunhoffer diffraction pattern for a uniformly ...
function h = showAnaglyph(im1, im2, alpha) % SHOWANAGLYPH Displays anaglyph of two images % % Other m-files required: none % Subfunctions: none % MAT-files required: none % % Author: Gabriel Moreira % email: gmoreira (at) isr.tecnico.ulisboa.pt % Website: https://www.github.com/gabmoreira/maks % La...
%%ImaqGUI edited hy H Yang for EPSRC project "Tensor tomography" function varargout = tensorguiDK(varargin) % TENSORGUIDK M-file for tensorguiDK.fig % TENSORGUIDK, by itself, creates a new TENSORGUIDK or raises the existing % singleton*. % % H = TENSORGUIDK returns the handle to a new TENSORGUIDK o...
function [ seg, segments ] = applySegEquivToSeg( eClasses, seg, segments ) %APPLYSEGEQUIVTOSEG Apply a segment equivalence relation to seg. % INPUT eClasses: [Nx1] cell % Each entry contains an [Mx1] int array specifying the segment % IDs which should be merged. % Note that each equivalenc...
function D = Q_codebook(N, Q, q) % 新的DFT码本方案,可实现过采样 % N 为天线数量 % Q 为量化比特 % a 为虚拟角度细分成程度 %% choose = 1; %临时代码 if nargin == 1 q = N * 8; Q = N; elseif nargin == 2 q = 2^Q * 8; Q = 2^Q; else % disp('ok') if q < 0 q = -q; choose = 0; end q = 2^Q * q; Q = 2^Q; end RF = DFT_set(N,...
% this code builds the LODF and PTDF matrices % PTDF - POWER TRANSFER DISTRIBUTION FACTORS % LODF - LINE OTAGE DISTRIBUTION FACTORS PTDF = zeros(numline,numline); % PTDF matrix LODF = zeros(numline,numline); % LODF matrix RadialLines = zeros(1,numline); % table of lines shows radials Bx = zeros(numbus,...
function [v,R] = slvcentdir_coneopt(v,rs,K,pars,R) % get the current right hand side: r1 = rs.r1; r2 = rs.r2; r3 = rs.r3; r4 = rs.r4; r5 = rs.r5; %testing: %ck = v.mu*(1/v.kappa); ck = v.tau; [d,v.CF] = solve_linear_system(v.F{3},v.mu,pars.A,pars.b,pars.c,v.tau,v.kappa,... r1,r2,r3,r4,r5,pars); %[d,v...
close all; clear;clc; %%%%%%%%%产生仿真数据%%%%%%%%%% n = 2; total = 1000; sigma = 1; v = sigma*randn(total,1); %噪声 z = zeros(1,total); u = zeros(1,total); uf = zeros(1,n); yf = zeros(1,n); vf = zeros(1,n); fai0 = zeros(3*n,1); e1 = zeros(1,total); e2 = zeros(1,total); e3 = zeros(1,total); e4 = zeros(1,total); e5 = zeros...
function depth = load_depth_map(filename, target_sz) fid = fopen(filename, 'rb'); sz = fread(fid, 2, 'int'); h = sz(1); w = sz(2); raw_depth = fread(fid, h*w*3, 'double'); raw_depth = reshape(raw_depth, 3, []); x = reshape(raw_depth(1,:), w, h)'; y = reshape(raw_depth(2,:), w, h)'; z = reshape(raw_depth(3,:), w, h)'; s...
%robotics.PRMは3Ⅾはできない %-----------生データ生成-----------% SampleNum = 50; theta = linspace(0, 2 * pi, SampleNum); funcX = @(th) 1 * sin(th); funcY = @(th) 1 * sin(2 * th); Position = zeros(SampleNum, 3); % [cm] for i = 1 : SampleNum Position(i, 1) = funcX(theta(i)); Position(i, 2) = funcY(theta(i)); Position(...
function poly_coeffs=Zad4(limits,n) % n=4; h=2/n; x_limits=[limits(1), limits(2)]; % zakres x wezly=x_limits(1):h:x_limits(2); % węzły f_x=1./(2+wezly.^2); % wartości w wezłach mat1=vander(wezly); % macierz Vandermonde'a poly_coeffs=mat1\f_x'; % współczynniki wielomianu poprzez dzielenie % plotowani...
function [Inew,D,orient]= SADTFD_new_iterative(S,alpha1,alpha2,N) %length %alpha=0.25; R=3; %D = mtfd(S, 'WVD');%,0.04,0.04); D = mtfd(S, 'CKD',1,0.3,0.3); [MM,~]=size(D); D_avg = zeros(length(S), length(S)); for mm = 1:MM, D_avg = D{mm,mm} + D_avg; end DD=D; D_avg=real(D_avg)/MM; %D=DD; M=180; ...
%% 1D coherence matlab/unity % need to write results to a txt file % https://research.computing.yale.edu/hpc/faq/how-can-i-run-matlab-batch-mode-without-gui % run w/o a gui would be good. clear all, clc %% set up TCP socket with Unity t = tcpip('127.0.0.1',10061,'NetworkRole','Client','Timeout',60); fopen(t) t %% S...
clc; clear; spoon1 = load('ironcup_spoon_1.txt'); spoon2 = load('ironcup_spoon_2.txt'); spoon3 = load('ironcup_spoon_3.txt'); acrylic1 = load('ironcup_acrylic_1.txt'); acrylic2 = load('ironcup_acrylic_2.txt'); acrylic3 = load('ironcup_acrylic_3.txt'); al_ruler1 = load('ironcup_al_ruler_1.txt'); al_ruler2 = load...
%Task2 % General Values lambda_values = [100, 120, 140, 160, 180, 200]; fname = "movies.txt"; % Configuration 1 c1_n = 10; c1_S = 100; % Configuration 2 c2_n = 4; c2_S = 250; % Configuration 3 c3_n = 1; c3_S = 1000; %% %2a N_times = 10; alfa = 0.1; W = 0; p = 0.2; R = 10000; [medias_b_4k_c1, terms_b_4k_c1, medias...
clc,clear N = 300; z = randn(N,1)*0.3; z(1:N/2) = z(1:N/2) + 4; x = z; x_old = x; x_bar = x; y = zeros(N,1); plot(z) niters = 50; sigma = 25; tau = 0.01; theta = 0.5; for i = 1:niters for j = 2:N de_xi_xj = x_bar(j) - x_bar(j-1); y(j) = proxFConj(y(j)+sigma*de_xi_xj); end for j = 2:N ...
%[f, x0, xn, y0, h]=GetValue(@TestF, 0, 1, 0, 0.1); f=@F; x0=0; xn=10; y0=0; h=0.5; [x1,y1]=RungeKutta( f, x0, xn, y0, h ); [x2,y2]=Adams4x( f, x0, xn, y0, h ); y3=(x1.*(x1.^2 - 12))./3; plot(x1,y1,'ro', x2,y2,'b*', x1,y3);hold on; %fplot(dsolve('Dy=x^2-4','y(0)=0','x'),[x0,xn]); grid, xlabel('自变量 X'), y...
run init.m % frequency measurement.Fs = Fs; % date measurement.date = datetime('now'); d = measurement.date; % parameters and descriptions dist = input('Enter distance >> '); measurement.distance = dist; measurement.description = input('Any description? >> ', 's'); % fil...
%% COMPUTE DMD % step 0 XD1 = XDAT(:,1:end-1); XD2 = XDAT(:,2:end); % step 1 [U,S,V] = svd(XD1,0); % step 2 Sinv = S(1:r,1:r)^(-1); Atilde = U(:,1:r)'*XD2*V(:,1:r)*Sinv(1:r,1:r); % step 3 [W,D] = eig(Atilde); % step 4 Phi = XD2*V(:,1:r)*Sinv*W; %% Plot DMD eigenvalues figure, hold on dmdeigs = log(eig(Atilde))*100; la...
function dx = backprop(dy,x,y,settings) %MAPMINMAX.BACKPROP Backpropagate derivatives from outputs to inputs % Copyright 2012-2015 The MathWorks, Inc. dx = bsxfun(@times,dy,settings.gain); end
%Phu Tssran %Final Project: Bose-Einstein %AMATH 481 %12/10/15 clc; close all; %setup L = pi; n = 16; dx = 2*L/n; dy = dx; dz = dx; x = -L:dx:L; x = x(1:n); y = x; z = x; dt = 0.5; tEnd = 4; tSpan = 0:dt:tEnd; a = -1; b = -a; kx = (2*pi/(2*L)).*[0:(n/2 - 1) (-n/2):-1]; kx(1) = 10^-6; ky = kx; ...
function data = correctDExtCell(data, directExtn, indexes ) % correctTraces Apply crosstalk and scaling corrections to fluorescence traces. % % DATA = correctTraces(DATA, CROSSTALK, SCALING) modifies the Traces object DATA % in place (left hand argument is optional), applying the given CROSSTALK % and channel...
function data = read_pfm(filepath) % read_pfm .pfm Datei auslesen. % data = read_pfm(path) % Diese Funktion liest die .pfm Datei unter dem Pfad path aus und % gibt die enthaltenen Daten als uint8 Matrix (data) zurück. % Handelt es sich bei der .pfm Datei um ein Farbbild, werden alle % ...
% Function to calculate the 3n X 3n (3D) grand mobility matrix M for a % given configuration R of the n beads. R is a vector of size 2n containing % the x,y coordinates. The (2*ii - 1)th element is the xcoordinate of the % ii-th bead % grand_fric is the (sparse) grand matrix containing the diagonal elements(matrice...
% THIS FUNCTION IS PRIVATE AND SHOULD NOT BE CALLED BY OUTSIDE CODE! % 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 [sm] = ChkC...
%-------------------------------------------------------------------------- % % Mjday: Modified Julian Date from calendar date and time % % Inputs: % year, month, day, hour, min, sec % % output: % Mjd Modified Julian Date % % Last modified: 2018/01/27 M. Mahooti % %---------------------------------------------...
function sexy(s) %SEXY Display a symbolic expression in human readable form. % SEXY(S) displays the symbolic expression S in a small figure window, % using standard mathematical notation. % % Examples: % syms x t positive % f=taylor(cos(x)); % sexy(f) % f=int(exp(-t)*t^(x-1),t,0,inf); % sexy(f) %...
function net = pruneEmptyWeights(net) % Remove empty weights from network structure, leaves numLayerDelays alone for i=1:net.numLayers if net.biasConnect(i) && isempty(net.b{i}); net.biasConnect(i) = false; net.biases{i} = []; net.b{i} = []; end for j=1:net.numInputs if net.inputConnect(i,j) && i...
for i = 1:length(CRI_total_vals) if ~isnan(CRI_total_vals(i)) CRI_all_vals(i) = CRI_total_vals(i); else CRI_all_vals(i) = worksheet(i,36); end end
function [fAndg] = getFex(y, para) %getFex Easy access to the evaluation of the li,ki of the user function % (meaning f and g of the rungekutta scheme). % %INPUT vector y Flat solution of the newton algorithm. % struct para Internal rungekutta parameter. % %OUTPUT matrix f fAndg(i,idxFlatDynamic) = f(l...
%%1) a) Hf=tf(2,[50 15 1],'iodelay',3); %bode(Hf) Hc=tf([1.08*28.57 1.08],[28.57 0]); Hd=Hf*Hc; bode(Hd) %% b) Hf=tf(2,[50 15 1],'iodelay',3); % bode(Hf) Hc=tf(0.9*[10.54 1],[1.054 1]); Hd=Hf*Hc; bode(Hd)
%% Perform assorted supporting analyses, statistical tests, and ad hoc inspections. % Not all of these analyses are reported in the associated manuscript; some % are sanity checks, some are uninteresting. % % Analysis code for Simon task MEEG dataset. % % Author: Marrit Zuure % 2019 %% Set paths dirs = setpaths(); %%...
function num = freezing(A) num = sum(A < 32); end
clear all ; close all subs = {'alex','dina','genevieve','jeremie','russell','valerie','tegan'} ; compinds = {[16,25,14,12,46,64,80],[8,23,2,31,40,41],[18,40,9,15,48,61],[4,21,1,81,84,67],[53,50,14,74,79,80],[17,20,2,41,75,77],[31,33,31,48,50]} ; % fmri badcomps = {[1,2,3,6,16,20,29,35:44,46:49,51:64],[1,2,4,5,7,10...
% script to perform various experiments without the GUI % % Daan Seynaeve 2016 addpath(genpath('.')) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% REP = 'path'; % representation NIND=200; % 50 % Number of individuals MAXGEN=100; % 100 % Maximum no. of generations % NVAR=26; %26 % No. o...
[Q,x,t,cons] = adv(500,0.3,4,1,0.1); mesh(t,x,Q) T = [0 90 180 260 360 450 510 630 667]; for i = 1:9 %subplot(3,3,i); titre = sprintf('Height for T = %f', T(i)*4/(length(t)-1)); %plot(x,Q(:,T(i)+1));axis([0 10 1 1.11]);xlabel('x');title(titre); end
function [P,D] = project_cam(w,cv,cx,cy,cz,p) %Rotation of camera coordinate system - transposed so that we can get %the points translated R_T = transpose([cx cy cz]); %Inverse transformation matrix L_inv=[R_T (-R_T*cv);zeros(1,3) 1]; %Create transformation matrix object trans = t...
function [] = plotResult(Xf, Zv, varargin) figure(1); clf; hold on; nVarargs = length(varargin); if nVarargs >0 Gt = varargin{1}; % plot ground truth x = Gt(25:3:end); y = Gt(26:3:end); z = Gt(27:3:end); plot3(x, y, z, 'ro'); end % plot where I think they should be x = Xf(25:3:end); y = Xf(26:3:en...
clear clc close all out = csvread("Output.csv"); dim1 = out(1) dim2 = out(2) dim3 = out(3) dim4 = out(4) nums = out(5:end); dV = zeros(dim1, dim2, dim3, dim4); count = 1; for i=1:dim1 for j=1:dim2 for k=1:dim3 for l=1:dim4 ans = nums(count); i...
% bisect is a function which determines values of % W(x) using the bisection method. It is used only as a check on % the accuracy of wapr.m. This routine is not used directly, % rather it is called by wapr_test.m % % Syntax: % [b,ner]=bisect(xx,nb,l) % % b is the value of W(xx) computed % % ner is the error c...
function plot_path(map, path) % PLOT_PATH Visualize a path through an environment % PLOT_PATH(map, path) creates a figure showing a path through the % environment. path is an N-by-3 matrix where each row corresponds to the % (x, y, z) coordinates of one point along the path. % bounds = map{1,7}; % board_bound =...
function child=crossover(population,seln); %Crossover operartion %此处seln只有一组家庭(array) %返回seln中一对父母的独生子,child(array) p=size(population,2); %get the fixed genes fixedgenes=0; fixednum=0; for i=1:p for j=1:p if(population(seln(1),i)==population(seln(2),j)) fixednum=fixednum+1; fixedgene...
function Rt = SVD_solve_voxel(AIF,Ct,deltaT,method) % This function solve (Ab=c) using SVD for b, (as shown in the paper of % Ostergard 1996), for a single voxel. % A is matrix built from AIF, % Ct=c=concentration curve at a voxel, method='constant' or 'linear' (assumption on the % difference between 2 tim...
% graber for individual fir for heritabylity analysis clear %on Peuplier % path_fir = '/media/database3/twins_study/stability_fir_exp1/stability_group/fir/'; exp = 'exp1c' path_fir = '/media/database3/twins_study/stability_fir_exp1/glm_fir_dep/fir'; path_fmri = '/media/database3/twins_study/old_exp/fmri_prepr...
% Berechne Kennzahl aus Kollisionserkennung % % Eingabe: % R % Matlab-Klasse für zu optimierenden Roboter (SerRob/ParRob) % X % Trajektorie im Arbeitsraum (Basis-KS) % Set % Einstellungen des Optimierungsalgorithmus (aus cds_settings_defaults.m) % Structure % Eigenschaften der Roboterstruktur (aus cds_gen_robo...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % A-weighting Filter % % with MATLAB Implementation % % % % Author: M.Sc. Eng. Hristo Zhivomirov 06/01/14 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function cq=CONSTQ_fft(x, cqkernel, lenwin, noverlap ) % x must be a row vector % This function calcolate the stft with constant Q division using the implementation % found in the paper of [Benjamin Blankertz] The Constant Q Transform % The first two value x and cq kernel are mandatory % x: the signal to be tra...
rt = 'I:\Gokul\GDrive\JaneliaSharedwithGokul\ExpansionRelated\Nc82_synapseData'; load([rt filesep 'dataLoad.mat']); sigma = [1.26, 1.4; 1.4, 1.5]; overwrite = true; apath =[]; Mode = 'xyzAc'; MinHoleVolume = 50; FitMixtures = false; MaxMixtures = 1; if isempty(apath) % store results locally in cell/Analysis di...