text stringlengths 8 6.12M |
|---|
function [X,Objfun,sprs,NSRE] = DILL1_test(Y,D,lambda)
[n,N]=size(Y);
[~,J]=size(D);
X=zeros(J,N);
for i=1:N
z=solveLasso(Y(:,i),D,lambda);
X(:,i)=z.beta;
if any(i == floor(N/20:N/20:N)), fprintf('.'); end;
end
Objfun=norm(Y-(D*X),'fro')^2+(lambda*sum(sum(abs(X))));
sprs=nnz(X)/(n*N);
NSRE=norm(... |
%@(#) whereis.m 1.5 05/12/08 10:32:16
%
%function ij=whereis(buidnt,distfile);
function ij=whereis(buidnt,distfile);
[dist,mminj]=readdist7(distfile,'asyid');
j=strmatch(buidnt,dist);
if ~isempty(j),ij=knum2cpos(j,mminj);else ij=[];end
|
% When you compile you need to include everything
% which is in "feval" and you need to comment out
% "updatesoftwarepath"
mbuild -setup
mcc -m gononlinear -o gononlinear -a gononlinear ...
gradobjfunction objfunction
|
%
% Save_DICOM_to_mat
%
% Purpose: Save GE DICOM Data and header to mat file (for faster
% opening). File name is generated from scan name, and file is stored
% in current directory (you can cd to the directory prior to calling
% this routine).
%
% Author: Jan Axelsson
%
% Input:... |
%% Clearing Commands
clc
clear
close all
%% Question 3 part a
% we need to define the range from -10 -> 10
figure('Name','Part A');
n_array = -10:10
n_array_minus = n_array * -1
x_f = @(n) exp(-2.*abs(n)).*sin(n.*(2.*pi/36))
x_f_even_comp = @(n)(x_f(n) + x_f(-n))/2
x_f_odd_comp = @(n)(x_f(n) - x_f(-n))/2
... |
function ovallODE_060914
%Fixed initial conditions & model parameters
Gb = 92; %[mg/dL] baseline glucose conc. in plasma
Ib = 11;%[uU/mL] baseline insulin conc. in plasma
Cb = 54.57 %[uU/mL] baseline C-PEPTIDE conc. in plasma
x0(1) = 279;%[mg/dL] glucose conc. in plasma
x0(2) = 0;
x0(3) = 409.5;%100; %[uU/mL] insuli... |
function phiFaceAverage = tvdMean1D(phi, u, FL)
% This function gets the value of the field variable phi defined
% over the MeshStructure and calculates the TVD average on
% the cell faces, based on the direction of the velocity vector for a uniform mesh.
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
... |
%% Control Parameters
dt = 0.1; % Sampling time (control)
% dt_ol = 0.001;
% DT = 0.05; % Sampling time (numerical integration)
DT_plant = 0.005;
% DT_anal = 0.05;
nz = 6; % No. of states
nu = 3; % No. of inputs
Hu = 15; % Control horizon
Hi = 1; % No. of time steps over... |
function [y,varargout]=tsraster(r,t,varargin)
% [y,x]=tsraster(r,t,['pre',2,'post',2,'bin_size',0.01)
% Computes the cross-correlation of 2 point processes, r(ef) and t(arget)
% using a time w(indow) in sec.
% either provide one window input and it will use +/- w or provide pre and
% post.
% r and t should be vectors o... |
function [PRB_H_1_0]=PRB_H(n_e,T_e);
global n_e_data_PRB_H;
global T_e_data_PRB_H;
global Table_PRB_H_1_0;
PRB_H_1_0=interp2(n_e_data_PRB_H,T_e_data_PRB_H,Table_PRB_H_1_0,n_e,T_e,'spline');
%interpolation function for recombination and bremsstrahlung power coefficient of H (1+->0)
|
function [] = MorseBeep(StringIn,varargin)
NumVarArgsIn = size(varargin,2);
if mod(NumVarArgsIn,2)>0
error('Number of arguments inputted must be even')
end
varargin = reshape(varargin,2,NumVarArgsIn/2);
fs = 20e3;% Hz sampling frequency of sound
SoundFreq = 440; %Hz, Frequency of sound played
DotTime = 0.1; %How ... |
function [traficos_aleatorios] = muestras_aleatorias(traficos, ventana)
if (str2num(ventana) > length(traficos))
printf('\n\nError: Ventana es mayor que tamano del trafico');
endif
valores_random = [];
ataques = [length(traficos),columns(traficos)];
normal = [length(traficos),columns(traficos)];
i... |
clear
close all
% From Beaudry, Galizia, Portier
% et = alp0 + alp1*Xt + alp2*et-1 + alp3*et + mut
% Parameterization
alp0 = 0.4;
alp1 = - 0.1;
alp2 = 1.2;
del = 0.05;
% Steady State
eold = 0;
Xold = 0;
err = 1;
simss = 0;
while err > 10^(-14) && simss < 1000
% Choice Variable
enew = alp0 + alp1... |
% for ODE1 Implict method
function [t,y] = ode_khan(tstop,dt,y0,u)
nsteps=round(tstop/dt)+1;
y=zeros(nsteps,1);
t=zeros(nsteps,1);
y(1)=y0;
t(1)=0;
for i=1:nsteps-1
y(i+1)=y(i)/(1-u(1)*dt); % specific to ODE1 only!!!
t(i+1)=t(i)+dt;
end
end
|
function [CELLS,CHANNELS] = segmentationMP(I,params)
%[CELLS,CHANNELS] = segmentationMP(I). Cell segmentation of the intensity matrix I
%from mother machine data, output CELLS is a structured array
%Segmentation parameters
resizeScale = params.resizeScale;
se = params.se;
cellAreaMin = params.cellAreaMin;
%... |
%% Receiver Operating Characteristic (ROC) curve
% This script plots the ROC for the Gibbs concentration factor
% and a 5-point detector.
close all; clear all; clc
%% Initialization
% Define the Fourier modes
nModes = 128;
fourModes = (-nModes:nModes).';
% Generate a (periodic) physical space grid
nGridPts = 256;
... |
%Excercise_317%
%Date: 10/5/2012
%Author: Jason Hsu
%%%%%%
%Data%
%%%%%%
A = [0.60 0.20 0.20 0; 0.20 0.60 0 0.20; 0.20 0 0.60 0.20; 0 0.20 0.20 0.60];
T1 = [0.25; 0.25; 0.25; 0.25];
T2 = [0.35; 0.3; 0.2; 0.15];
T3 = [0.4; 0.3; 0.2; 0.1];
m_flowrate=10000;
%%%%%%%%
%Part A%
%%%%%%%%
x1 = [A\T1];
x2 = [A\T2];
x3 = [A\T... |
% solveStrictWirtFlow.m
%
% Strict Implementation of the Wirtinger Flow (WF) algorithm proposed in
% the paper. This code mirrors the experiment performed on random 1-D
% gaussian data in section 4.2 of the paper.
%
%% I/O
% Inputs:
% A: m x n matrix or a function handle to a method... |
function [sn,dayShiftStart,dayShiftEnd,nightShiftStart,nightShiftEnd,transitionStart,transitionEnd] = importShiftCalendar(workbookFile,sheetName,startRow,endRow)
%importShiftCalendar Import data from a spreadsheet
% [sn,dayShiftStart,dayShiftEnd,nightShiftStart,nightShiftEnd,transitionStart,transitionEnd]
% = impor... |
%Original code by DJ Walsh
%NU Baja Blackbox Reader
clear all; close all; clc;
file_name = input('Please enter the MATLAB folder filepath: ','s');
test_file = load(file_name);
time = test_file(1:end,1); %Time (ms)
accel = test_file(1:end,2:4); %AccelX,AccelY,AccelZ (g's)
gyro = test_file(1:end,5:7);... |
function [ A, B ] = sysc_SpringMass( n, varargin )
%SYSC_SPRINGMASS Generate the CT system matrices for a Spring-Mass system
%
% Generate the continuous-time system A and B matrices for a spring-mass
% system that takes the form of:
% k1 m1 k2 m2 k3 m3 k4 kn mn k(n+1)
% ~~~*~~~~~*~~~~~*~~~~...~~*~~~~~
%
% T... |
function [FCBrain_AllWindow, zFCBrain_AllWindow, Header] = y_SCA_Window(WindowSize, WindowStep, WindowType, AllVolume, ROIDef, OutputName, MaskData, IsMultipleLabel, ROISelectedIndex, IsNeedDetrend, Band, TR, TemporalMask, ScrubbingMethod, ScrubbingTiming, Header, CUTNUMBER)
% [FCBrain_AllWindow, zFCBrain_AllWindow, H... |
function vote_weight=get_vote_weights(bob, idx)
% vote_weights=booster_base.get_vote_weight(bob, idx)
% Copyright (c) 1998 GMD Berlin - All rights reserved
% THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD Berlin
% The copyright notice above does not evidence any
% actual or intended publication of this work.
v... |
function h = setframeplot( R, P, length, h )
% plot frame
R=R*length;
for i=1:3
set(h(i),'XData',P(1),...
'YData',P(2),...
'ZData',P(3),...
'UData',R(1,i),...
'VData',R(2,i),...
'WData',R(3,i));
end
end
|
classdef APDPulseSequence < handle
%APDPULSESEQUENCE Summary of this class goes here
% Currently only supports one counter line
properties
ni % NIDAQ driver
pb % PulseBlaster handle
seq % Handle to sequence object
end
properties(Se... |
classdef SecureSOAP
properties
login;
password;
passphrase;
end
methods
function obj = SecureSOAP (login, password)
obj.login = login;
obj.password = password;
% Create passphrase Base64
encoder = org.apache.c... |
%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%
%&% %&%
%&% Εργασία Δημητριάδη Σωκράτη Α.Μ.:359 %&%
%&% %&%
%&% Τ.08 - ΘΕΜΑΤΑ ΨΗΦΙΑΚΗΣ ΕΠΕΞΕΡΓΑΣΙΑΣ ΕΙΚΟΝΑΣ %&%
%&% ΣΥΜΠΙΕΣΗ ΚΑΙ... |
tic;
close all;
clc;
clear;
hold on;
axis equal;
%---------------------------------------------------
% Initialisations
%---------------------------------------------------
declareGlobals
init
rotateBack = false;
scanSpeed = 15;
COM_CloseNXT all;
handle = COM_OpenNXT();
COM_SetDefaultNXT(handle);
port = SENSOR_2;
... |
function [gabout] = FDisk_Location(in,G,Fk1)
%%% 本函数对图像做2D-gabor变换
% Usage:
% [gabout] = FDisk_Location(in,G,Fk1)
% input parameter:
% in —— 待滤波图像(灰度图)
% G —— a series of Gabor wavelets
% Fk1 —— Gabor系数图序列号
% output parameter:
% gabout —— Gabor系数图
%% eye location of new editi... |
function [h,hcb]=FakeColor(X,Y,Z,varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% function h=FakeColor(X,Y,Z,clims,nc,colmap,plotcb,cbpos)
%
% Work-around for multiple colormaps
%
% ex.:
% h=FakeColor(time,depth,u)
% h=FakeColor(time,depth,u,0.6*[-1 1],10,'jet','right')
% h=FakeColor(time,d... |
%
% function that takes no inputs
% calculates two different pi approximations
% finds the smallest N for which the apporoximation
% is smaller than the tolerance
%
function calculate_Pi_Sums()
format long
tol = 1e-6; % tolerance away from pi
err1 = 1;
% first approximation of pi
Na = -1; % initialized to -1 so po... |
function [nlin_str, nlin_str_nice] = getNonlinearityStr(networkOpts)
nlin_str = '';
nlin_str_nice = '';
if isfield(networkOpts, 'nLinType')
if strcmpi(networkOpts.nLinType, 'relu')
nlin_str = '_rl';
nlin_str_nice = '(ReLU)';
elseif strcmpi(network... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Uniform Crossover %
% %
% Author : Julie... |
function t_C = fahrenheit2celsius (t_F)
t_C = (t_F - 32.0) / 1.8;
|
% main function
clear all, close all, clc;
% code of computing mutual information
% addpath('./mi/');
% dataset folder
addpath('./data/');
score = [];
% feature ranking
feature_list = [];
[feature_sel,error_rate,rmse] = func_feature_selection(10,false,[1],0.1,true,...
'classification',2);
disp(['error_rate: ' 'm... |
close all;
img = imread('parrot.jpg'); %choose a picture
%img = imread('parrot_med.png'); %
%img = imread('parrot_big.png'); % these work as well
resol = size(img); %get its specs
height = resol(1);
width = resol(2);
X = img(:,:,1); X = X(:); %extract individual color vectors
Y = img(:,:,2); Y = Y(:);
Z = img(:,:,3)... |
function [input pedigree] = pre_cfs(reordered)
[input pedigree] = pre_processing(reordered, 1);
end
|
% Name: David Soller
% Last.#: soller.23
% Assignment: HW 6 - MeanshiftTrack
img1 = double(imread('data/img1.jpg'));
img2 = double(imread('data/img2.jpg'));
radius = 25;
x = 150.0;
y = 175.0;
bins = 16;
h = 25;
% hold on;
% imagesc(img1/255);
% axis('image');
% axis ij;
% plot(x,y,'+','Color','g');
% hold off;
% paus... |
clear all;
close all;
N=64;
Ts=1/N; Fs=N; df=Fs/N;% sampling
Im(N/8:N/4,N/4+1:N/2) =1;
Im(1:N/4,N/2+1:N) = Im;
Im(N/4+1:N/2,:) = Im;
Im(N/2+1:3*N/4,:) = Im(1:N/4,:);
Im(3*N/4+1:N,:) = Im(1:N/4,:);
img_fft = fft2(Im);
img_fft_shift = fftshift(img_fft);
subplot(2, 2, 1);
imshow(Im);
subplot(2,2, 2);
imagesc(100*log(... |
% https://www.comsol.com/model/out-of-plane-heat-transfer-for-a-thin-plate-493
close all;
clear all;
clc;
tF = 500; % Simulation time, modify accordingly
dz = 0.01;
cp = 385;
K = 400;
rho = 8960;
alpha = K/(rho*cp);
beta = dz*rho*cp;
dx = 0.01;
dy = 0.01;
dt = 0.001; % Small enough to not caus... |
% MQLQM .M
% for saving to SMIS
% Generated from mpmain
% Set up for menu position and offset ********************************
mmgmincr = mmgmincr + 1 ;
mflnmxyoff = mmgmxyoff*mmgmincr ;
mflnmxypos = mmgmxypos + mflnmxyoff ;
figure('Position',mflnmxypos) ; % New menu window
% Globals
global mqlemtxt mqluipfil3 mqlsp... |
function [Out OutList]=getSpecificInfos(varargin)
% ShortInfos=load(getComputerParams('ShortInfosFN'),'ShortInfos');
% ShortInfos=ShortInfos.ShortInfos;
if(mod(nargin,2)==1)
Lnargin=nargin-1;
Lvarargin=varargin(2:end);
GotInfos=true;
ShortInfosArr=varargin{1};
else
GotInfos=false;
Lnargin=nargin... |
% Calculates a more general version of the Markov test of Pajhede (2014)
%
% USAGE
% [Test, asymptotics, name, varargout] = fGeneralizedMarkovtest(I,p,lags,criteria,sign,bootstrap)
%
% INPUTS:
% I - Hit-sequence, I, column vector
% lags - Number of lags against which we want power
% p ... |
function tlslattice
% TLS 2003 lattice file is generated for loco.
% Peace Chang, Dec 17, 2002.
% M.H. Wang, January 06,2003
% Peace Chang, January 06, 2003
% Peace Chang, January 15, 2009
global FAMLIST THERING
Energy = 1.5e9;
FAMLIST = cell(0);
L0 = 1.20e+002; % design length [m]
C0 = 299792458; % speed... |
function queue = queueFuns
queue.enQueue = @enQueue;
queue.deQueue = @deQueue;
end
function newQueue = enQueue(oldQueue, newValue)
%将后来的值插入到数组后面(队列),然后取出的时候,先取前面的(先进先出原则)
newQueue = [oldQueue, newValue];
end
function [newQueue,popedValue] = deQueue(oldQueue)
%判断堆栈是否为空
[~, c] = size(oldQueue);
if c < 1
... |
function varargout = MATLAB_vital_important(varargin)
% MATLAB_VITAL_IMPORTANT MATLAB code for MATLAB_vital_important.fig
% MATLAB_VITAL_IMPORTANT, by itself, creates a new MATLAB_VITAL_IMPORTANT or raises the existing
% singleton*.
%
% H = MATLAB_VITAL_IMPORTANT returns the handle to a new MATLAB_VITAL_... |
function [A] = adjacency_matrix(E)
% ADJACENCY_MATRIX Build sparse adjacency matrix from edge list or face list
%
% [A] = adjacency_matrix(E)
% [A] = adjacency_matrix(F)
% [A] = adjacency_matrix(T)
%
% Inputs:
% E #E by 2 edges list
% or
% F #F by 3 triangle list
% or
% T #F by 4... |
function [] = display_opengl(centers, points, model_points, outside_points, blocks, radii, display_points, face_alpha)
[blocks] = reindex(radii, blocks);
path = 'C:\Users\tkach\OneDrive\EPFL\Code\HModel\display\opengl-renderer-vs\Input\';
scaling_factor = 27;
for i = 1:length(centers)
centers{i} = centers{i} / s... |
clc
clear
close all
%%
%Image input and select path
[FileName,FilePath]=uigetfile('*')
Inputimage=imread(strcat(FilePath,FileName));
Inputimage1=Inputimage;
%% Show image
figure(1)
imshow(Inputimage);
title('Input Image ')
%% Convert to gray scale
if size(Inputimage,3)==3 % RGB image
Inputimage=rgb2gray(I... |
function [RawROI,ROILeftCoords] = FormROIImg(CurImg_raw,NbLensCoords,LensRadius)
RawImgSizetem = size(CurImg_raw);
RawImgSize = [ RawImgSizetem(2), RawImgSizetem(1)];
% 首先确定感兴趣区域的大致范围
maxX = min( max(NbLensCoords(:,1))+4*LensRadius , RawImgSize(1) ); %%%%%%%%%%
m... |
%my first for loop
clear all; close all; clc;
% angle(rad)
theta= [0:(pi/8):(2*pi)];
%looop thru index
for idx= 1:17
%calc y
y(idx) =sin(theta(idx));
end
plot (theta,y)
title('the sine func')
xlabel ('theta(rads)')
ylabel ('sin(theta)')
|
function WriteDatabase( tComputer )
%
% open the file
fid = fopen(tComputer.strDatabaseFilename, 'w');
%
% header
fprintf(fid, 'deviceID, xCoordinate, yCoordinate, zCoordinate, signalsID\n' );
%
% data
for iRowIndex = 1:numel(tComputer.tDatabase{1})
%
fprintf(fid, ...
'%.5f, %.5f, %.... |
% Author: Jinxin Yang
% Function: check whether a point is in the circle
% Parameters: x_t,y_t (target point); x0, y0, r (target circle)
function is_In = is_InCircle (x_t, y_t, x0, y0, r)
if ( (x_t-x0)*(x_t-x0) + (y_t-y0)*(y_t-y0) ) <= r*r
is_In = true;
else is_In = false;
end
end |
%% sub function to get N and initial coordinates
function [x_min, x_max, y_min, y_max] = get_limits(Board,coord)
%% Inputs
% Board is the current Board, a 10x10 matrix
% coord are the current coordinates where we may place a ship
%% Outputs
% in the current row, x_min through x_max are all open spaces, and th... |
function BER = ComputeBER(bit_seq,rec_bit_seq)
%
% Inputs:
% bit_seq: The input bit sequence
% rec_bit_seq: The output bit sequence
% Outputs:
% BER: Computed BER
%
% This function takes the input and output bit sequences and computes the
% BER
%%% WRITE YOUR CODE HERE
incorrectBits = 0;
... |
% Find the registration of the dVRK PSM to a base marker seen by the micron
% tracker. Accomplished with rigid registration of end-effector locations
% as measured in both the micron tracker measurements and the dVRK forward
% kinematics
function robot_H_micron = register_micron_PSM(folder,filename,plotOption)
baseLab... |
function mi = calc_mi(u1, u2, wind_size)
x = [u1, u2];
n = wind_size;
[xrow, xcol] = size(x);
bin = zeros(xrow,xcol);
pmf = zeros(n, 2);
for i = 1:2
minx = min(x(:,i));
maxx = max(x(:,i));
binwidth = (maxx - minx) / n;
edges = minx + binwidth*(0:n);
histcEdges = [-Inf edges(2:end-1) Inf];
[occur... |
function result = mpEllipticE( Phi, M )
%MPELLIPTICE Legendre elliptic integral of the second kind.
% MPELLIPTICE(Phi,K) is elliptic integral of 2nd kind of the
% elements of Phi (argument) and K (modulus). Phi and K must be real and
% the same size or any of them can be scalar.
%
% MPELLIPTICE(K) is the comp... |
function S = LoadSpikes(cfg_in)
% S = LoadSpikes(cfg)
%
% Loads MClust *.t files containing spike timestamps
%
% input cfg fields:
%
% cfg.fc: cell array containing filenames to load
% if no file_list field is specified, loads all *.t files in current dir
% cfg.load_questionable_cells = 0; % load *._t files if set to... |
function linearODESolveanmarP2X4tri()
global k1 k2 k3 k4 k5 k6 L1 L2 L3 H0 H1 H2 H3 H4 H5 H6 H7 g1 g2 E1 E2 alpha beta gamma J V A n1 n2 Gmin Hmin rmin p0 Acell Tsoln I Y imin imax t0 Q;
%#codegen
generatorMatrixanmarP2X4tri();
for i=imin:imax
p0=p0*expm(Q*(Tsoln(i)-t0));
Y(i,:)=p0;
I(i)=10^12*(g1*(p0(6)+p... |
function [V, newX, D] = pca_function(X)
X = bsxfun(@minus, X, mean(X,1)); %# Zero-centering with mean
C = (X'*X)./(size(X,1)-1); %'# Computing the covariance matriz of given data (X)
[V,D] = eig(C);
[D, order] = sort(diag(D), 'descend'); %# sort cols high to low
V =... |
function Imask4 = NeckMaskCLean(Imask);
% NeckMaskCLean: clean a neck mask by removing small elements and opening
%
% Imask4 = NeckMaskCLean(Imask);
%
% OS CWRU, 19-jan-04
% --- remove small stuff.
Imask = imopen(Imask,strel('disk',1,0));
% --- keep the biggest CCA
Imask2 = bwlabel(Imask,8);
s = r... |
X = [1, 2, 5, 8, 10, 20, 50, 70.987];
A1 = [0.3888, 0.3875, 0.3922, 0.3822, 0.3817, 0.3635, 0.3402, 0.3275];
A2 = [0.4348, 0.4182, 0.4013, 0.3887, 0.3894, 0.3707, 0.3407, 0.3304];
A3 = [0.3594, 0.3416, 0.3477, 0.3397, 0.3321, 0.3261, 0.3271, 0.3213];
A4 = [0.3520, 0.3035, 0.3065, 0.3058, 0.3050, 0.3070, 0.3273, 0.3691... |
function [mImage] = loadImage(sImageFilename, posNum)
%
% Loads the set of positions.
%
% load the cPartitions file
fImageFilename = fopen(sImageFilename);
sLine = fgetl(fImageFilename);
currLine = 1;
mImage = zeros(posNum, posNum);
while ischar(sLine)
cLine = textscan(sLine, '%f', 'Delimiter', ',');
vEntrie... |
function [mu, row] = coherence(A)
% [mu, row] = coherence(A)
%
% Finds the coherence of the matrix A.
% Let U be a orthonormal basis for the column space of A. The coherence
% of A is equal to the maximum squared row norm of U.
%
% Output:
% mu - the coherence.
% row - row which held the largest row norm.... |
% kill python server if you know pid
pid = 111111110;
system(sprintf('Taskkill /PID %d /F', pid));
% kill python server if you do not know pid (may not work)
system('Taskkill /IM python.exe /F'); |
function [img_cs_1d,Theta_1d,Phi,mat_dct_1d]=getCSdata(Src,scale)
% if model==0
% load temp
[height,width]=size(Src);
mat_dct_1d=zeros(height,width);
for k=0:1:floor(height/scale)-1
dct_1d=cos([0:1:width-1]'*k*pi/width);
if k>0
dct_1d=dct_1d-mean(dct_1d);
end;
... |
function J_s = get_J_s(y, config)
% Get total spacecraft inertia
% Gimbal frame axes
[A, G, H] = get_AGH(y, config);
% Spacecraft body
J_B = diag([config.model.J_B_x, config.model.J_B_y, config.model.J_B_z]);
% Total inertia
J_s = J_B + config.model.J_T_f*(A*A')+config.model.J_T_g... |
% optical sweep with different power
% WTJ, 20180809
% LNNB16, 4K
% WTJ, 20180912
%% parameters
G0 = 5000;
atten0 = 26;
P0 = 0.7; % in uW
% attens = [33:-1:17];
Ps = linspace(0.5, 60, 30);
attens = getAttensFromPowers(Ps, P0, atten0 );
attens(attens<=0) = [];
attens = [attens flip(attens)];
gains =... |
%% load all provided images
img = imread('MRI.png'); % Load the image
mask = imread('InitialMask.png'); % Load the mask of regions of interest
GT = imread('GT.png'); % Load the ground truth
GT = ~imbinarize(GT); % binarize the gournd truth for easy comparision
%% apply segmentation
seg_img = activecontour(img,mask,70... |
% Foot Lift (guard)
function guard = lift(model, load_path, varargin)
% Parse inputs
p = inputParser;
p.addOptional('leg', 'left')
p.addOptional('next_domain', 'flight')
p.parse(varargin{:});
parser_results = p.Results;
% Default domain name
Name = 'Lift';
... |
function mHPI_PlotHPIin3D( SensPos, HPIpos, displgd )
%MHPI_PLOTHPIIN3D displays the position of the HPIs in "HPIpos" within the
%helmet whose properties are defined by "SensPos".
% - "SensPos": properties of the helmer (especially, position of the
% sensors).
% - "HPIpos": coordinates of the HPIs.
%
% Copyr... |
function H_n = Hilbert_n(n)
H_n=zeros(n);
for i=1:n
for j=1:n
H_n(i,j)=1/(i+j-1);
end
end |
%Harris角点检测算子 先做高斯平滑 在求梯度
function [fLocX,fLocY,fcount,tmp]=hari(Input)
[saX,saY]=size(Input);
win=5;% 原为6,5
var=0.7;
for i=1:3
for j=1:3
gauW(i,j)=1/(2*pi*var^2)*exp(-((i-2)^2+(j-2)^2)/(2*var^2));
end;
end;
[dimX,dimY]=size(Input);
for i=2:dimX-1
for j=2:dimY-1
Inpu... |
function nodeSelected(src,evt, main_figure)
selNode=src.getSelectedNodes;
%layer_tree_tab_comp=getappdata(main_figure,'Layer_tree_tab');
layers=get_esp3_prop('layers');
layer=get_current_layer();
% fig=ancestor(layer_tree_tab_comp.layer_tree_tab,'figure');
% %
% modifier = get(fig,'SelectionType');
% control = strcmp(... |
% PlotQuadratic.m
% Tabulate a quadratic function and plot
% f = x^2 + b*x + c
%
% Author: Mojolagbe Jamiu
clc;
clear;
%% set parameters
Nx = 300;
xmin = -3;
xmax = 3;
b = -2;
c = 4;
%% tabulate values
x = linspace(xmin, xmax, Nx);
f = x.^2 + b*x + c;
%% plot functions
plot(x, f);
xlabel(' x (m... |
%In class 19
% Problem 1. Imagine a clinical trial for two drugs that are intended to lower
% cholesterol. Assume 30 subjects are randomly divided into 3 groups that
% either receive a placebo or one of the two treatments. The mean initial
% levels of total cholesterol in each group are the same. The final
% measureme... |
% File: Example3_01 for Example 3-1
clear;
% Spectrum of Naturally Sampled PAM.
% Assume analog waveform has a rectangular spectrum with
% bandwidth B
B = 5;
fs = 20;
f = -10:1:100;
W = zeros(length(f),1);
W = PULSE(W,f,-B,B);
n = 0:1:6;
% d is the sample pulse width divided by the sampling period.
d = 1/3;
x = pi... |
function [Ymag,f]=fftplotlinear(y,Fs)
% Create a plot of the fft of the signal in y
% f is the sample frequency
[m,n]=size(y);
if m==1
L=n; nc=1; y=y';
elseif n==1
L=m; nc=1;
else
L=m; nc=n;
end
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
for i=1:nc
Y(:,i... |
clear all; close all; clc;
% Eduardo H. Santos
% 12/12/2017
%
%
% (*) Eu não entendi muito bem o código do Zarchan. Limitação minha. Sendo
% assim, eu decidi então refazer todo o cálculo do livro por meio de
% equações no espaço de estados (acredito que fica mais fácil para
% mim).
%
% (*) As ... |
clear;
clc;
close all;
FileName = '3-松弛因子-relax(1)=0.4';
Convergence_accuracy = 1E-5;
fidin=fopen([FileName,'.DAT']);
Line_Process=1;
DataProcess = zeros();
while ~feof(fidin) % 判断是否为文件末尾
tline=fgetl(fidin); % 从文件读行
size_tlin... |
function tar_p=kick_ball(ball_p,ball_tar,agt_p,agt_r)
% KICK_BALL produces a target position of ball.
% BALL_P is a 2D position of ball; BALL_TAR is the ball's current target position.
% AGT_P is the agent's 2D position, while AGT_R is its orientation in angle.
% TAR_P is the target position of ball.
% If the ball is o... |
clear;
load('Area PRO_retentate (0.01) RO recovery calculated in 10-Oct-2014.mat');
%opt_area=opt;
%load('Recycling PRO_retentate (0.01) RO recovery calculated in 08-Oct-2014.mat');
for i=1:length(opt)
y(i,:)=co_PRO3(opt(i,1:4));
%y_a(i,:)=co_PRO3(opt_area(i,1:4));
end
y0=.1:.01:.7;
nsec=y(:,1);
deltaP_pro=y(:,... |
clear all;
close all;
clc;
prompt = {'Gain Statique', 'w0p', 'w0'};
dlgtitle = 'Paramètres G(p)';
line = 1; def = {'1', '1', '6.66'};
procede = inputdlg(prompt, dlgtitle, line, def);
G0 = str2num(char(procede(1)));
w0p = str2num(char(procede(2)));
w0 = str2num(char(procede(3)));
p = tf('s');
G = G0/((p/w0p)*(p/w0 + 1... |
%Section 1.4
%Problem 4
%Define function
f = @(x) 5*sin(x)^2-8*cos(x)^5;
for i=1:10
%Secant
[x(i),~,~,~]=Secant(f,0.5,1.5,10e-16,i,0);
end
x = x';
e = x - x(10)';
fprintf(' x error\n')
disp([x,e]) |
toc
tic
clear outcast recast
% correct the particles that are out of simulation domain
% by giving them a position randomly in the initial distribution
outcast=find(alphas_psi>NB_PSI-2);
recast=randi(Nalphas_simulated,size(outcast,1),1);
if (~isem... |
# Ejercicio 1
# Reactor Monod
colors = ['r';'g';'b';'k';'c';'m'];
Mux = linspace(0.1,1,5);
km = linspace(0.1,2,5);
yxs = linspace(1,4,5);
Bo = 0.1; # gDW/L biomasa
So = 1.5; # mmol/L
Muo = (0.3)*(1.5/(1.5 + 0.2));
co = [So; Bo]';
t = [0:1:60]'; # Horas
function dX = f(x,t)
global Yxs
global mux
global Km
... |
% This script is for working with Zoiray-formatted (.mat) image files.
% Fit Parameters
media = 'air';
dApprox = 100; % nm
% LUT Parameters, in nm
minus = 2;
plus = 15;
dt = .1;
% Get image file names
% This means "Grab any file that contains the phrase 'DataSet' and ends with '.mat'"
imageDir = uigetdir;
nameRegEx... |
function [center_freq] = get_center_frequency(lower_freq,upper_freq)
% GET_CENTER_FREQUENCY gets center frequency between two bounds
product = abs(lower_freq*upper_freq);
r = sqrt(product);
center_freq =r;
end
|
function r = test_interpolate_field()
clf; hold on;
test_field = [1 2; 3 4];
X = linspace(1,2,10);
Y = linspace(1,2,10);
for i = 1:10
for j = 1:10
plot3(X(i), Y(j), interpolate_field(test_field, X(i), Y(j)), 'o');
end
end
end
|
clear all ; close all;
cd('E:\TMS EEG');
eeg = pop_loadbv('.','C01_SC_TMS_TS.vhdr');
eeg = pop_chanedit(eeg,'lookup','C:\eeglab10_0_0_0b\plugins\dipfit2.2\standard_BESA\standard-10-5-cap385.elp') ;
stimtrigs = {'S 1','S 2','S 4','S 8'};
%stimtrigs = {'S 4','S 5','S 6','S 12'};
neweeg = eeg;
for tr=1... |
lp = calcLightFR(lp);
%lp = calcLightFRall(lp);
figure;
hold on;
xlbl = '';
clr ='brmk';
switch lp.scriptType
case {'SIMULTAN STIMULI'}
stimuliRangeValues = 1:3;
xlbl = ['1 - ' num2str(lp.events(1,:)) ' 3- ' num2str(lp.events(end,:)) ]
case {'INTENSITY STI... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 2008 Copyright (c) Hamed Hamid Muhammed %%
%% All rights reserved. %%
%% %%
%% School of Technology and Health %%
%% Royal Institute of Tachnology %%
%% E-mail: hamed@sth.kth.se ... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% The system response to exp(-3t)u(t) to is t*exp(-3t)u(t)
clear all;
syms t w
x=exp(-3*t) *heaviside(t);
y=t*exp(-3*t) *heaviside(t);
X=fourier(x,w) ;
Y=fourier(y,w);
%Frequency Response
H=Y/... |
clear all;
clc;
close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Discretisation
global ly hbar m kp sig x0 y0
hbar=1.0545718*10^-34;
m=9.10938*10^-31;
sig=8e-11;
lamda=5.5e-11;
kp=2*(pi/lamda)*[1,0];
dx=5e-12;
dy=5e-12;
dt=1e-21;
xf=1e-9;
yf=0.7e-9;
tf=5e-17;... |
function [f,t,w]=enframe(x,win,inc,m)
%ENFRAME split signal up into (overlapping) frames: one per row. [F,T]=(X,WIN,INC)
%
% Usage: (1) f=enframe(x,n) % split into frames of length n
% (2) f=enframe(x,hamming(n,'periodic'),n/4) % use a 75% overlapped Hamming window of length n
% (3) freque... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function doCompileOccurencesTextonsSplit
% Compiles the textons results obtained from the training data
%
% Input parameters:
%
% Output parameters:
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function... |
function order_stacks_fig(main_figure,curr_disp)
mini_axes_comp=getappdata(main_figure,'Mini_axes');
axes_panel_comp=getappdata(main_figure,'Axes_panel');
if isempty(curr_disp)
curr_disp=get_esp3_prop('curr_disp');
end
switch curr_disp.CursorMode
case {'Normal' 'Create Region'}
bt_on_top=0;
otherw... |
%%
clear;clc
%! Prepare GRAM and ORIGINAL folders first !%
root_dir = 'E:\Datasets\SVHN\all';
feat_name = 'raw';
mix_num = 500;
vars = all_vars(root_dir, feat_name, mix_num);
write_config(vars);
hmm_dir = vars.flat_hmm_dir; % start with flat hmms
hmm_defs_path = fullfile(hmm_dir, vars.hmm_defs);
... |
function [ qedf ] = efq( a,b,f,blk_size )
%% by zoe 2012/1/3 email:dreamcather1986@163.com
%compute the edge-dependent fusion quality index
% 输入: 源图像 a,b
% 融合图像 f
% 分块大小ble_size
%输出: quality index Qabf
%例如: qedf=efqQ('1.bmp','2.bmp',8)
apl=1;
% x1=imread(a);
x1=a;
x1=edge(x1,'canny'); % edge image of a
% ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.