text stringlengths 8 6.12M |
|---|
%Sunday 19/5/2019
%Adding Personal Best
%covergencing with the Probolobility
clc
clear
[lb,ub,dim,fobj] = Get_Functions_details('F11');
%inicilize population
Leader_score=inf;
NU=3;
US=10;
Unit=[];
Unit_Cap=[];
Unit_Best=[];
convergence_curve=[];
MT=1;
spirit_power_factor=200/MT;
AO=1/NU;
t=0;
SP=1; %SP(Stleath ... |
%
% From https://github.com/jpeelle/jp_matlab
inputDirectory = '~/Desktop/soundFilesHere';
outputDirectory = inputDirectory; % (can specify a different save path if needed)
channels = [1 2 4 8 16 32]; % you can have multiple levels here, e.g. [16 8 4]
%% NB You probably don't have to change anything after this po... |
% TODO: different line styles for different curves
function [ ]= myplot(data, m, label,legend_label, mytitle, display_sum)
% data = struct containing all data
% m = row index to consider for each data item
% label = title of y axis
% legend_label = legend of label (before the number)
% mytitle = title of graph
% displ... |
function [y_plot,z_plot] = Plot_YZ_pseudo_only_plot(plot_switch,plot_density,xr_plot,yr_plot,zr_plot,x_want,x,y,z,pseudo2_matrix,title_txt)
%calculate and plot the pseudo_potential's YZ plane
%center pseudo is just the center point which is calculated by the potential on YZ plane٬ in a 2D plane .
%
[xq,yq,zq]=... |
function dam_actogram2(o,well,mode,cutoff)
%DAM_ACTOGRAM Plot actograms of DAM information
% dam_actogram(o,well(s),mode,cutoff)
%
% o: dam data, as read with dam_load.
% well: list of flies (columns), mean will be computed
% mode,cutoff: see actogram
%%(C)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
c = 299792458;
r1 = sqrt(0.971); % ITM
r2 = sqrt(1 - 200e-6); % ETM + cavity losses
L = 3995;
fsr = c/(2*L);
f_c = fsr * log(r1*r2) / (2*pi);
r_c = @(phi) (r1 - r2 * exp(2i*phi)) ./ (1 - r1 * r2 * exp(2i*phi));
Gamma = 0.1;
phi = linspace(-0.01, 0.01, 301)*pi;
phi_mod = pi/2 - pi/4;
I = 1... |
function generate_frames(input,output1,output2)
files=dir(input);
dirFlags=[files.isdir];
folders=files(dirFlags);
for i=3:length(folders)
input_dict=strcat(input,'\',folders(i).name);
output_dict=strcat(output1,'\',folders(i).name);
output_dict2=strcat(output2,'\',folders(i).name);
if exist(output_dict... |
function [logged] = logData(x)
%% logData log transforms the MS image intensity matrix
%% Input: x - Intensity matrix [rows x columns x mz]
% Output: logged - Intensity matrix [rows x columns x mz]
%
%% Author: Nazanin Z. Kermani, , Imperial College London 2016.
% values smaller than 10 with be nagati... |
%% plot raw growth curve
% load data
load('singe_growth_curve.mat');
% plot growth curve
figure
plot(t,odraw,'.-');
xlabel('Time (hours)');
ylabel('OD_{raw} (a.u.)','interpreter','tex');
%%
print('fig/raw od v t','-dpng','-r150');
%% plot log-transformed, background-subtracted growth curve
logod = lo... |
% run a perturbation experiment script
k_vec = [Y_set_all(1,3),Y_set_all(1,7),Y_set_all(1,12),Y_set_all(1,21)];
t_row = 2;
t_col = 16;
num_per = 20;
num_runs = 20;
res = zeros(num_per, num_runs, numel(k_vec));
figure;imagesc(mdp.img);
for i = 1:num_per
disp(['perturbation ' num2str(i)]);
mdp_p = perturb_mdp(mdp... |
#Number of tours generated
X = [3:15];
Tours_ALL=[2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200];
semilogy(X, Tours_ALL);
legend('All Generated',"location", "north");
xlabel('Cities (3-15)', 'FontSize',12,'FontWeight','bold');
ylabel('Tours Generated', 'FontSize',12,'FontWeight','bo... |
function [pathfind,newnode] = extend_rrtree1only(tree2node)
global map ;
pathfind = 0;
[map_row,map_col] = size(map);
while(pathfind == 0)
% rand num
if (rand()<0.5)
rand_node = rand(1,2).*[map_row,map_col];
else
rand_node = tree2node; % from Goal to Start
end
% extend t... |
%% Written by Dongchan Lee, July 2017
% We assume proportional control for AGC without considering interarea exchange error.
% So this is really just with primary frequency control.
clear; close all;
%% Load case study and initialize
mpc=eval('case39'); % Imports data from MATPOWER
num_bus=size(mpc.bus,1);
num... |
function Img = get_img_from_VI(V, I, width,hard_threshold,para)
% define smallest digit number
d_i = (max(I)-min(I))/width;
d_v = (max(V)-min(V))/width;
% find the index where the VI goes through in current-voltage axis
ind_i = ceil((I-min(I))/d_i);
ind_v = ceil((V-min(V))/d_v);
ind_i(ind_i>... |
function [ unwrappedPhase ] = prelude( rawPhase, mag, varargin)
%PRELUDE
%
% PRELUDE calls FSL Prelude
%
% unwrappedPhase = PRELUDE( rawPhase, mag )
% unwrappedPhase = PRELUDE( rawPhase, mag, ... )
%
% .......................
%
% rawPhase: 3d array of the wrapped phase values
% mag: 3d array of the cor... |
%% INPUTS:
%% K := numberf of nearest neighbors
%% OUTPUTS:
%% CELL OF OVERCOMPLETE DICTIONARY OF ALL PATCHES IN K IMAGES
function [ output_args ] = mqBuildOverCompleteDictionary(NUM_NEAREST_NEIGHBORS , PATCH_SIZE)
%% assume training set is all same size & same # of patches
k_patches = cell(NUM_NEAREST_... |
function newI = ReflectEdge(I,d)
%Version:1.0——灰色图像 Time:2013/05/01
%Version:1.1——灰色/彩色图像 Time:2013/05/02
%考虑到实用性,决定不添加更多的边界处理选择,统一使用:reflect across edge
if size(I,3)==1
newI = ReflectEdgeGray(I,d);
elseif size(I,3)==3
newI = ReflectEdgeColor(I,d);
else
error('Incorrect image size')
end
... |
%% ------------------------------------------------------------------------%
% EE 569 Homework #3
% Date: Nov. 1, 2015
% Name: Faiyadh Shahid
% ID: 4054-4699-70
% Email: fshahid@usc.edu
%------------------------------------------------------------------------%
function CMYK_img = RGBtoCMYK(RGB_img)
% Converts RGB to C... |
function plot_ground(xis, Ns)
x = [3:2:11];
y = zeros(1, size(x, 2));
row = size(xis, 2) / 2;
cols = ['r', 'g', 'b', 'm', 'c'];
p = zeros(1, size(Ns, 2));
legendtitle = cell(1, size(Ns, 2));
figure; cla;
for i = 1 : size(xis, 2)
subplot(row, 2, i);
hold on;
for j... |
%% fn_savemovie
%% Syntax
% M = fn_savemovie(a[,fname][,clip][,fps][,zoom][,map][,hf])
% M = fn_savemovie(a[,'fname',fname][,'clip',clip],...)
%% Description
% Input:
% - a x-y-t array (be aware Matlab convention for images is y-x)
% or x-y-c-t for true colors (c stands for the 3 color channels,
... |
%% Load the cdf_inv of actual distribution
delete('LoopListsCond1/*')
delete('LoopListsCond2/*')
cdf_inv_pofl = load("pofL_cdf_inv.mat");
cdf_inv_pofl = cdf_inv_pofl.dummyVar;
delX = cdf_inv_pofl(2,1)-cdf_inv_pofl(1,1);
%%
%Intialise Condensin at different sites
%rng(445)
monomerSize = 100; %bps
delT = 1; %seconds
pa... |
function [CI, Confidence, BMean] = uq_BiasReducingBootstrap_CI(Replications, PointEstimates, Alpha)
% [CI, NCONF,BMEAN] = UQ_BIASREDUCINGBOOTSTRAP_CI(REPLICATIONS, POINTESTIMATES):
% Returns bootstrap confidence intervals on the estimation of
% PointEstimates taking into account the bootstrap replication data... |
%
% ws - window size
% min_rw - minimum road width
% max_rw - maximum road width
%
% both must be odd number & ws > 3*max_rw
%
function fb = gen_filter_bank(ws, min_rw, max_rw)
fb = zeros(ws, ws, ((max_rw-min_rw)/2+1));
gf = fspecial('gaussian', [ws ws], ws/3);
for i=min_rw:2:max_rw
... |
clc
clear all
close all
path='./Kha_Nguyen_HW5/'; % this is your working path
impath= [path,'Flower2.jpg'];
im=imread(impath);
im_Original=imresize(im,[256,256]); % crop the image to pixel of 256*256
out_impath=[path,'Flower_Sized.jpg'];% path of the output im
imwrite(im_Original,out_impath);
imS = im_Original;
im... |
function [REPEATED_POINTS SELEC_POINTS B_SELECTED cond_NUMB_WITHOUT INDICES_EXPAND cond_NUMB_WITH] = GivenIndices(PHI,ng,CLASS_INTEGER,PARAM_STUDY,npg,ntens,INDICES)
% See greedy_algorithms.m
PHI_RED = PHI(INDICES,:) ;
M = PHI_RED'*PHI_RED;
cond_NUMB_WITHOUT = cond(M);
%% But it is instructive (and even necessary) to... |
% main12a.m for illutration of a non-stationary linear model
% Lars Kai Hansen, DTU Copmute 2016
%
% non-stationary linear model
% fixed prior and noise level
clc
d=7;
alf0=100.0; % large precidion => small changes in time
beta0=1.0; % precision of additive noise
Ntrain=1000;
Ntest=1000;
% generate data
xtrain=... |
% get effector position from the external world
% X_curr(1,1) = endEffectorPosition(1);
% X_curr(2,1) = endEffectorPosition(2);
% Theta(1) = jointAngles(1);
% Theta(2) = jointAngles(2);
X_curr(1, 1) = sensor.endEffPos(2, 1);
X_curr(2, 1) = sensor.endEffPos(2, 2);
Theta(1) = sensor.jointAngles(2, 1);
Theta(2) = sensor.j... |
clear;
addpath(genpath(pwd));
imgRoot = '../dataset/newdata/';
imgOrigin = '../dataset/graynewdata/';
imgDest = '../dataset/sunscribble/';
imnames=dir([imgRoot '*' '.bmp']);
addpath(genpath(pwd));
for ii = 51:length(imnames)
disp(ii);
imname=[imgOrigin imnames(ii).name(1:end-4)];
img = imname;
%... |
clear all;
mfld = fileparts(mfilename('fullpath'));
cd(mfld);
% add variable variate lib:
addpath([mfld filesep() 'var']);
fs = 10;
N = 10;
f = [5]*fs/10;
phi = 0.25*pi;
A = 1;
dc = 0;
t(:,1) = [0:N-1]/fs;
u = dc + sum(A.*sin(t*2*pi*f + phi),2);
U = fft(u)/N
Ui = 2*j*fft(u)/N
y1 = U(N/2+1);
y2 = Ui(N/2+... |
function DirNum=GetDirectoryNum(structFilesList)
FieldName=fieldnames(structFilesList);
DirNum=strmatch('isdir', FieldName);
|
function [recordingFolder,subID] = MI1_offline_training()
%% MOTOR IMAGERY Training Scaffolding
% This code creates a training paradigm with (#) classes on screen for
% (#) numTrials. Before each trial, one of the targets is cued (and remains
% cued for the entire trial).This code assumes EEG is recorded and streamed
... |
% Names: Jens Daci and Jonathan Coskuner
% Course: Signals and Systems
% Description: This code reads the .wav file and plots the following:
% 1. Time Domain Graph
% 2. Frequency Domain Graph
% 3. Spectrogram
% Reading the file
filename = 'song.wav';
[original... |
function grad = B_log(future_layers, input,b)
grad = 0;
for i=1:length(future_layers)
grad = grad + 1./(input+b).*future_layers{i}.grad;
end
end |
function r = crop(obj,ROI)
% This function crops 2D X-ray data stored in a Blade Object
% Parameters are:
% ROI = vector with [qpar_min qpar_max qz_min qz_max]
%
% The function returns:
% Blade Object with the cropped data
%
% Copyright & Questions: Laboratory of membrane and protein dynamics, McMaster Univers... |
function data = emse_read_bin(filename)
% based on emseReadInverse, plus patch for reading binary
% inverse files...
% JMA - Pulled this out of mrCurrent
fid=fopen(filename,'rb','ieee-le');
if (~fid)
error('Could not open file');
end
% Get the magic number
magicNum=fscanf(fid,'%c',8);
if (strcmp(upper(mag... |
function [x, y, z] = Trigono(q1, q2, q3)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
l1=25.5; l2=3;
z=l1-q2;
hipo=sqrt((l2)^2+(q3)^2);
ang=atand(q3/l2);
ang_1=ang+q1;
x=hipo*cosd(ang_1);
y=(hipo*sind(ang_1))+l2;
x1=l2*cosd(q1+90);
y1=l2*s... |
function main(varargin)
args = get_args(varargin);
close('all');
switch args.experiment
case 0
training(args);
case 1
experiment_1(args);
case 2
experiment_2(args);
end
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sandpile simulation environment
%
%
%f = critical_field(50,50,3,false);
%f = 3*ones(50,50);
f = zeros(30,30);
%f, neighbour, critical_state, ...
% collapse_per_neighbour, timesteps, boundary_type, make_pictures, ...
% silent, driving_pl... |
clear all
[y,fs]=audioread('recording.wav');
ts=1/fs;
t=[(1/fs):(1/fs):((length(y))/fs)];
figure(1);
subplot(2,1,1);
plot(t,y);title('Origin Signal Wave');xlabel('Time t');grid on;
subplot(2,1,2);
num=length(y);
plot((-num/2:num/2-1)/num*fs,abs(fftshift(fft(y))));
title('Origin Signal Freq');xlabel('frequence Hz');grid... |
clear all;close all;hold on;
a=-sqrt(2); %lower bound for uniform distribution
b=sqrt(2);
L=unifrnd(0,b,1); %lenght of line
x0=unifrnd(0-L/2,1+L/2,1); %x distance from origin
y0=unifrnd(0-L/2,1+L/2,1); %y distance from origin
angle=unifrnd(0,2*p... |
function [ my_w_out ] = stochastic_lms_step(my_w,my_data,my_target,my_obs,my_learning_rate)
%stochastic_lms Summary of this function goes here
% Detailed explanation goes here
ind = randi(10,1,1);
% Lets use w to make a prediction for one value of our training set
selected_data = my_data(ind,:);
% Let... |
clear all; close all;
addpath(genpath('support_files'));
global USE_COVAS
USE_COVAS=1;
global PARALLEL_PORT
if USE_COVAS==1
%initialize parallel port
PARALLEL_PORT=digitalio('parallel', 'LPT1');
addline(PARALLEL_PORT, 0:7, 'out');
end
for i=1:24
fprintf('\nTrial %d\n',i)
t=input('W... |
function [new_dataset] = feature_extraction(dataset, imgori, intensity_mean)
sizeofsub = size(imgori);
mask = find(imgori==imgori(1));
imgori(mask) = 0;
rp = imfill(double(imgori),'holes');
rp(rp>0) = max(max(rp));
[rpb,~] = bwlabel(rp);
rpbox = regionprops(rpb,'Centroid');
... |
%%反演工区路径
path='E:\苏里格\Sulige Inversion150403\';
path2='2测井曲线\测井曲线(处理后)\profile_model\';
filename3='profile_Depth.txt';filename=[path,path2,filename3];load(filename);profile_Depth=profile_Depth';
filename4='profile_Vp.txt'; filename=[path,path2,filename4];load(filename);profile_Vp=profile_Vp';
filename5='profile_Vs.tx... |
function [T] = compute_curvature_tensor_mesh(vertex, faces, method, options)
%
% compute_curvature_tensor_mesh - compute a curvature tensor on a
% triangulated mesh, given a maximal anisotropy ratio
%
% Inputs :
% - vertex
% - faces
% - Aniso : maximal anisotropy ratio
% Output:
% - T = exp(alpha Cmax)... |
function [t,n_diff] = make_tign(ps,alpha,p_param,grid_fraction)
%create palusible fire arrival time from detections
%inputs -
% ps = cluster_paths(w,1,grid_size)
% alpha - blending between initial estimate and estimate made using paths
% p_param - parameter of smoothing spline
% grid_fraction - shrink fact... |
function Def = SVAR( )
% SVAR [Not a public function] Default options for SVAR class functions.
%
% Backend IRIS function.
% No help provided.
% -IRIS Macroeconomic Modeling Toolbox.
% -Copyright (c) 2007-2017 IRIS Solutions Team.
%--------------------------------------------------------------------------
validFn =... |
function error_occured = detect_RAS_error(files)
%% INIT
error_occured=false;
progress=false;
% count number of lines in compute_msg
compute_msg_ID=fopen(files.compute_msg,'r');
frewind(compute_msg_ID);
nb_of_lines=0;
%% READING
while~feof(compute_msg_ID)
... |
clc; clear;
%initial state
y1_0=0;
y2_0=0;
ti=0;
tf=3;
[t,y]=ode45(@Diff,[ti,tf],[y1_0; y2_0]);
T=t;
Y1=y(:,1);
Y2=y(:,2);
for i=1:length(T)
dy=Diff(T(i), [Y1(i), Y2(i)]);
dY2(i)=dy(2);
end
plot(T,Y1,'-o',T,Y2,'-o',T,dY2,'-o')
title('Foward dynamics of 1 link Robot')
... |
function tests = MHyProEllipsoidTest
tests = functiontests(localfunctions);
end
function testEllipsoid(testCase)
% This script contains tests for all functions for HyPro Ellipsoids.
rad_eli = MHyProEllipsoid(2.1, 2);
mat_eli = MHyProEllipsoid([1 2; 3 4]);
copied_eli = MHyProEllipsoid(rad_eli);
% Check if ellipso... |
% (A)
X = [800 ;1200 ;1600];
Y = [400 800 1200];
% (B)
Pxy = [0.2 0.05 0.1;
0.05 0.2 0.1;
0.0 0.1 0.2];
% (C)
Py = sum(Pxy);
Px = sum(Pxy,2);
% (E)
Ex = myexpvalue(X,Px);
Ey = myexpvalue(Y,Py);
% (F)
[Sx,Sy] = ndgrid(X, Y)
% (H)
XYco = mycovariance(Sx,Sy,Pxy,Ex,Ey)
% (G)
% mycovariance(Sx, Sy, ... |
function varargout = fn_4Dview(varargin)
% function fn_4Dview(option1,optionArgs1,...)
% function varargout = fn_4Dview(action,actionArgs)
%---
% displays spatial or temporal slices of multi-dimensional data
% by default: data is considered to be 3D, 4D or 5D (dimensions ordered as
% x-y-z-t-m) and is displayed as 3 sp... |
%% Assignment 3 Q2
% Given K r and T, we can compute P, the projective transform
% where q = P[x,y,z,1]
% we take points q1 and q2 and given we have P we can find x,y,z,1 for
% those points in the real world
% x will be fixed, we can assume y will be fixed at 0 (no changes in
% elevation for the railway tracks so the... |
function R = restore_endm_by_bbl(R, bbl)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
if iscell(R)
for i = 1:length(R)
R{i} = restore_from_bbl(R{i}, bbl);
end
else
R = restore_from_bbl(R, bbl);
end
end
function R1 = restore_from_bbl(R, bbl)
[M,B1] = size(R);
R1 =... |
%sample period
Tsample =.001;
%sample period of control system
csysTsample =.02;
%simulation time in seconds
tsim = 30;
t = 0:Tsample:tsim;
%Motor constants
%18.1 mNm/A
Kt=18.1 / 1000;
%1.895 mv/rpm convert to v/(rad/s)
Ke=1.895*(1/1000)*(60)*(1/(2*pi));
R=28.2;
%the sum of all the moments of inertia (all the d... |
function C = create_cov(alt,mu1,mu2,sigma1,sigma2,d1,d2,l)
alt = alt(:);
npar = length(alt);
gfun = @(x,l) exp(-0.5*(x./l).^2);
C2 = zeros(npar,npar);
for i=1:npar
C2(i,:) = gfun(sqrt((alt-alt(i)).^2),l);
end
% sigma "profile"
sig = d1*gfun(alt-mu1,sigma1) + d2*gfun(alt-mu2,sigma2);
C = C2.*(sig*sig');
|
function [lik, latents] = lik_rl(P,data)
% Likelihood function for reinforcement learning agent on two-armed bandit
%
% USAGE: lik = lik_rl(P,data)
%
% INPUTS:
% P - structure of S parameter samples, with the following fields:
% .invtemp - [S x 1] inverse temperatures
% ... |
close all
clear all
Disha = 'DISHA';
Arihant = 'ARIHANT';
figure(1)
subplot(211)
title('On Arihant')
to_bit_pulse(Disha);
subplot(212)
title('On Disha')
to_bit_pulse(Arihant);
figure(2)
subplot(211)
title('On Arihant')
to_morse_pulse(Disha);
subplot(212)
title('On Disha')
to_morse_pulse(Arihant);
figure(3)
s... |
function basisobj = create_exponential_basis(rangeval, nbasis, ratevec)
% CREATE_EXPONENTIAL_BASIS Creates a exponential basis:
% exp[RATEVEC(1)*x], exp[RATEVEC(2)*x], ...
% Argument:
% RANGEVAL ... an array of length 2 containing the lower and upper
% boundaries for the rangeval of argume... |
function WriteRight(win, text, x, y, color)
%
% WriteRight(win, text, x, y, color)
%
% function writes a string TEXT to screen WIN in color COLOR. The
% right edge of the TEXT occurs at postion X and vertically centered at
% position Y.
%
% 05.18.06 M.Diaz
% 01.31.10 S.Fraundorf - PTB-3 version
% 02... |
clc;
close all;
clear all;
%get the video frame
tic
vidObj = VideoReader('bigfish.avi');
implay(read(vidObj, [50 150]));
vidHeight = vidObj.Height;
vidWidth = vidObj.Width;
info = get(vidObj);
s = struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'));
for k = 50:150 %hasFrame(vidObj)
s(k).cdata = read(vidObj,k);... |
function [betaCon vCon zmap] = spmJr_flex (root, DesMat, contrast, flags)
% spmJr_flex (file_root, Desmat, contrast_matrix)
%
% The extremely quick and dirty SPM analysis
%
% (c) 2010 Luis Hernandez-Garcia
% University of Michigan
% report bugs to: hernan@umich.edu
%
% The program solves the linear model specif... |
%showAlltestResult
for i = 1:601
im = imread(['./result/',int2str(i),'.png']);
imagesc(im)
pause(1);
end |
function [a,v,x,y,Fl,Fd,Nr,Nf,T_d,k]=FindVectorsOnStraightLine(Straight_Line,beta,m,v,dt,Fl,Fd,Nr,Nf,M,c,b,L,H,Miu,Miur,Miuf,R,A,Cd,Cl,Ro_air,g,Start_ratio,Gr,Final_ratio,T1,T2,T3,T4)
p=0;
t1=0;
t2=0;
t3=0;
k=1;
T_d=zeros; %% Total distance of the vehicle
x=zeros; %% Distance on x axis [m]
y=zeros... |
classdef Px0 < sqc.op.logical.operator
% x Projection operator (<0|-<1|)(|0>-|1>)/2
methods
function obj = Px0()
obj = obj@sqc.op.logical.operator();
obj.m = sym([1,-1;-1,1]/2);
end
end
end |
% HWK 9 Part 3
% Macky Brock McWhirter
% Auto-Regressive Model
clear all;
close all;
clc;
len = 60;
% Generate a whitenoise input vector
x = rand(len, 1)-0.5;
% Run through the system
y = hidden_system(x);
p = 9;
% Auto-Regressive Method
%a = aryule(y,p);
a = arburg(y,p);
figure();
fre... |
function a=transform_time_domainB_inv(a,fL,k)
ns=4; %<====== cfp4 !!!
[h,w,L0]=size(a); L=L0/ns; hL=L/2; qL=L/4;
%a=shiftdim(a,2);
a=single(a); a=shiftdim(a,2); %a=double(a); %<== save memery
if k==0
a(1:qL,:,:)=Haar_inv(a(1:qL,:,:) ); a(1:hL,:,:)=Haar_inv(a(1:hL,:,:) ); a(1:L,:,:)=Haar_inv(a(1:L,:,:) );
elseif k... |
% GetModal: Generates modal data from spatial mass and stiffness matrices
%
% [Modes,AircraftData,Griddata] = GetModal(MB,KB,Griddata,Zeta,AircraftData)
%
% This function takes in the spatial domain mass, damping and stiffness
% matrices, the and the modal damping ratios and outputs the modal domain
% data.
%
%
% I... |
function [x,lambda_star] = SphereLS(A,b,alpha)
% function x = SphereLS(A,b,alpha)
% Least squares minimization over a sphere.
% A is mxn, rank(A) = n, b is mx1, and alpha>0.
% x minimizes norm(Ax-b) over the sphere of radius alpha
% GVL4: Algorithm 6.2.1
[U,S,V] = svd(A,0);
s = diag(S);
btilde = U'*b;
xLS = V*... |
function fpic = MakeFeaturePic(ftype,W,H)
fpic = zeros(H,W);
x = ftype(1);
y = ftype(2);
w = ftype(3);
h = ftype(4);
switch ftype(5)
case 1
fpic(x:x+h-1,y:y+w-1) = ones(h,w);
fpic(x+h:x+2*h-1,y:y+w-1) = -ones(h,w);
case 2
fpic(x:x+h-1,y:y+w-1) = -ones(h,w);
fpic(x:x+h-1,y+w:y+2... |
function row = findHorizon(im)
% FINDHORIZON - computes the horizon line on poorly deliniated roads
% IM - grayscale double image
% ROW - Y coordinate of the horizon line
% set to 1,2 to display debug images ar various stages
DEBUG = 2;
ROWS = size(im,1); COLS = size(im,2);
e = edge(im,'sobel', [], 'horizont... |
%% Markowitz Portfolio Optimization
%
% min x'Sx
% s.t. p'x >= r_min
% 1'x = 1
% x >= 0
% sum_{i=1}^{0.1n} x[i] <= alpha
%
% x: portfolio weights
% S: portfolio covariance matrix
% p: mean return vector
% x[i]: ith greatest component in x
%
%% generate data
randn('state',0);
n=25; %number of items
p_mean... |
% Following script sets up 2 local variables.
% Quant[8][8] = typical luminance quant matrix for JPEG
% Zig[64] = zigzag scan index for 8x8 block for JPEG
Quant = [ 16, 11, 10, 16, 24, 40, 51, 61;
12, 12, 14, 19, 26, 58, 60, 55;
14, 13, 16, 24, 40, 57, 69, 56;
14, 17, 22, 29, 51, 87, 80,... |
%load overall data download from repositry
data = load('breastCancer.m');
%taking mean of column 7 to replace 0 (which is misplaced data) with mean
%value
%var = mean(data(:,7)) %replaced 0 with 3
trainingData = data(:,2:10); %EXCLUDING patient ID
classData = data(:,11); %data on which NN will be classified... |
function trials=trials_make(o,dt1,dt2)
%trials=trials_make(o,dt1,dt2)
% Make a cell array of trial matrices for EEG recording data o.
% Example usage:
% tr=trials_make(o,1,2)
% Each trial matrix is a 3D matrix with the dimensions
% n_samples x n_time x n_channels. dt1 and dt2 are the length
% of time in the EEG reco... |
function [d,p] = getPathInfo(path)
path(find(path==0)) = [];
d = path(end);
p = path(2:end-2);
end
|
%GENCOORDS Vector of symbolic generalized coordinates
%
% Q = R.GENCOORDS is a vector (1xN) of symbols [q1 q2 ... qN].
%
% [Q,QD] = R.GENCOORDS as above but QD is a vector (1xN) of
% symbols [qd1 qd2 ... qdN].
%
% [Q,QD,QDD] = R.GENCOORDS as above but QDD is a vector (1xN) of
% symbols [qdd1 qdd2 ... qddN].
... |
function [u_n, n_iter] = u_solve( u_n, alpha, K_10, K_20, h, p, Omega, err )
% -------------------------- Description ------------------------- %
% %
% This function receives a desired system of equations to solve %
% and return the calculted matrix u... |
% oi oi oi
|
function [ Eqns ] = Equilibrium_eqns_2(x,Kc)
% 1:N2, 2:O2, 3:NO, 4:NO+, 5:N, 6:O, 7:N+, 8:O+, , 9: e-, 10:N2+, 11:O2+
N_n=2*0.79;
N_o=2*0.21;
%Equilibrium Eqns
Eqns(1)=sqrt(x(1))*Kc(1)-x(5);
Eqns(2)=sqrt(x(2))*Kc(2)-x(6);
Eqns(3)=x(5)*x(6)*Kc(3)-x(3);
Eqns(4)=x(5)*Kc(4)-x(7)*x(9);
Eqns(5)=x(6)*Kc(5)-x(8)*x(9);
Eqns(6... |
function catCompute(sets,filename)
%catCompute Computes various statistics for cat data
% catCompute(sets,filename)
if(ischar(sets))
sets = str2num(sets);
end
% load refractory data
mat = load('refractory.mat');
rf = struct(mat.rf);
% get frame boundaries
rtlength = length(rf.data.rtEdges{1});
% take out last val... |
function varargout = ROIImportMain(varargin)
%%%Doc Starts%%%
%-Purpose:
%ROIs are imported into workspace through filters under \*\ImportExport\ImportModule\ROI\ROIImportMethod_*.
%-Format Description:
%1. Filters are defined in \*\ImportExport\ImportModule\ROI\ROIImportMethod_*.
%2. For the pinnacle format, pinna... |
disp('This is Group No.4')
disp('To calculate loads on cylinder:')
ip = input('Enter 1 for Ivagaki Method and 2 for Chakraborty method');
while (~(ip==1 || ip==2))
ip = input('Please input valid numbers Enter 1 for Ivagaki Method and 2 for Chakraborty method');
end
if(ip==1)
run('Wave_hydro_Ivagaki_uplusv_c... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Subject: Engineer Tools
% File: Attestation 4 - SW10
% Author: Ervin Mazlagic
% Date: Mai 3. 2013
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Preparations
clear;
clc;
%%%%% Exercise 4.1
x ... |
clc;
clear all;
[x, y] = meshgrid(-8:0.1:8, -8:0.1:8);
r = sqrt(x.^2 + y.^2);
z = sin(r)/r;
mesh(x, y, z); |
% pic common include
if exist('b_read_pic_option', 'var') && b_read_pic_option
global pic_prefix;
global pic_output;
global pic_output_color;
global fontsize;
global linewidth;
else
% whether we are in Octave or Matlab
is_octave = exist('OCTAVE_VERSION','builtin') ~= 0;
if is_octave
... |
clc;
clear;
m=2105;
m_fuel=88;
a=0.53;
b=-1.43;
d=1;
J_22=1883;
F0=2450;
alpha=m*b-m*a;
beta=m*a;
gama=((1/m)-(d/b)*((1/m)+(1/m_fuel)));
omega=(b-(J_22/b)*((1/m)+(1/m_fuel))-a);
%phi2=gama*f*alpha-omega*f-F0*phi*omega/(omega*beta-alpha*a);
A=[0 1;-F0/(omega*beta-alpha*a) 0];
B=[0;gama*alpha-omega/(om... |
xs1 = (1/2).^(1:8);
fs1 = exp(-xs1)./(1+xs1);
xs2 = 2*(1/2).^(1:8);
fs2 = exp(-xs2)./(1+xs2);
xs3 = 3*(1/2).^(1:8);
fs3 = exp(-xs3)./(1+xs3);
xlist = (1/2).^(1:8);
dd1 = divdif(xs1,fs1);
ps1 = dd_interp(xs1,dd1,xlist);
dd2 = divdif(xs2,fs2);
ps2 = dd_interp(xs2,dd2,xlist);
dd3 = divdif(xs3,fs3);
p... |
function rtnFunc = createTransitionFunc(a,b,c,x,y,zFunc,xs,ys,zs,h,t,s,muVal,sigmaVal)
% Create and clear variables
syms HTemp Expectation Bt
clear HTemp Expectation Bt
% Assign variables
K = 5;
J = K + 1;
% Calculate and assemble function
fXtoY = int(1 / sigmaV... |
clear all, close all, clc
addpath('F:\github\wearable-jacket\matlab\IEEE_sensors');
instrreset
ser = serial('COM15','BaudRate',115200);
ser.ReadAsyncMode = 'continuous';
fopen(ser);
addpath('F:\github\wearable-jacket\matlab\IEEE_sensors\JCS_data\');
LF = [0,0,0];
LA = [0,0,0];
RF = [0,0,0];
RA = [0,0,0];
qLA = [1 0 0... |
function [ d ] = dist_kinematics( X, Y, varargin)
%DISTXY Custom Distance metric for the JHU kinematics data
% 1-3 (3) : tooltip xyz
% 4-12 (9) : tooltip R
% 13-15 (3) : tooltip trans vel x', y', z'
% 16-18 (3) : tooltip rot_vel
% 19 (1) : gripper angle
% We use ... |
cd utils
mex assignmentoptimal.cpp
cd ..
% RRWM
cd Methods
cd RRWM
mex mexBistocNormalize_match_slack.cpp
cd ..
cd ..
path0 = cd;
% MPM
cd 'Methods/MPM';
mex -largeArrayDims RMP_mult.cpp
cd(path0);
cd 'lib/cell';
mex cellss.cpp;
mex oness.cpp;
mex zeross.cpp;
cd(path0);
cd 'src/asg/fgm/matrix';
mex multGXH.cpp;
... |
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/AMIGO_logUniformIntialGuess.m 1131 2013-12-02 12:48:47Z attila $
function guess = AMIGO_logUniformIntialGuess(lower_bound, upper_bound, plotflag, n_guess)
% create log-uniform distributed initial guesses for parameter estimation
%
% n_guess: number of guess
% every guess is... |
% -------------------------------------------------------------------
% Generated by MATLAB on 30-Nov-2016 10:27:33
% MATLAB version: 9.0.0.341360 (R2016a)
% -------------------------------------------------------------------
clear;
clc;
N = [8 16 32 64 128 256 512];
NumberFires = 100;
statistics = ...
[1 1 2 1 2... |
function [gmv] = predict_gm_volume(brwt, bvol, collation)
%function [gmv] = predict_gm_volume(brwt, bvol, collation)
%
% Predict grey matter volume (cm^3) via data from Rilling & Insel (1999a/b)
% and potentially others.
%
% Input:
% brwt: brain weight (g)
% bvol: [native units] brain volume (cm^3)
% collation:... |
function [tri x y z] = dem2tin(ZI,R,ZImask)
% If no referencing matrix is provided, make a generic one.
if isempty(R)
R = [0 1; 1 0; 0 0];
end
% Create the grid
[xi yi] = ir2xiyi(ZI,R);
[XI YI] = meshgrid(xi,yi);
% And extract the points that fit the provided mask.
x = XI(ZIma... |
function rate = getFIRA_rate(trials, spikei, rate_begin, rate_end)
% Compute spike rate for each trial TRIALS between rate begin and rate end
% function rate = getFIRA_rate(trials, spikei, rate_begin, rate_end)%
%
% INPUTS:
% trials : selection array for trials
% spikei : spike id
% rate_begin : rate... |
function KG=GeometryStiffnessPlate_stress_recovery(FEM,Stru,Laminate)
gDOF=FEM.GDof;
KG=zeros(gDOF,gDOF);
gauss_points_number = FEM.GaussPointBend;
% compute geometry stiffness layer by layer and sum them for one element
%%
%-----Geometry Stiffness due to Tranverse deformation------
% Cycle for each element, ... |
function sleep(x,y)
initial_phase=zeros(1,17439);
light_sleep=zeros(1,1130);
deep_sleep=zeros(1,10229);
x1=1;
x2=0;
x3=0;
aux=1;
cont=0;
lostpoints=0;
for i=x
cont=cont+1;
i;
if i<=1
initial_phase(x1)=i;
else
n=x(aux);
j=(i-n);
if j<=.8410 && j>0.6900
x1=x1+1;
initi... |
function A = assemb_A_Robin(K, alpha, mesh)
A = sparse(mesh.nbs,mesh.nbs);
% Boucle sur les triangles
for ie = 1:mesh.nbt
is = mesh.elm_som(ie,:);
x = mesh.som_coo(is,1);
y = mesh.som_coo(is,2);
a = circshift(mesh.som_coo(is,2),2)-circshift(mesh.som_coo(is,2),1);
b = circshift(m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.