text stringlengths 8 6.12M |
|---|
function OutFeatures=FCBF(Features,Target,threshold)
%% Apply Threshold
for i=1:size(Features,2)
I(i) = abs(MutualInformation(Features(:,i), Target));
end
[sortedI,indSort]=sort(I);
index_selected=find(sortedI>threshold);
NewFeatures=Features(:,indSort(index_selected));
%% Removing similarities
Matrix_Mu=z... |
function [flag2, r, theta0] = reflection(l0, d0)
n = [-l0(2) l0(1)]/norm(l0);
k = dot(d0,n);
if (k<0.0001 && k>-0.0001)
[flag2, r] = deal(0);
return;
end;
theta0 = acos(abs(dot(d0,l0)/norm(l0)));
r0 = [(d0(1)-2*k*n(1)),(d0(2)-2*k*n(2))];
r = r0/norm(r0);
flag2 = 1;
return;
end |
function [value, isterminal, direction] = myEvent(TIME, Y)
value = double(any(Y(5) >= Y(4)));
isterminal = 1; % Stop the integration
direction = 0; |
function [LOCSon,LOCSoff] = TC_Select_noGauss(MNum, h1, nfreq, amps, fig)
% This function is meant to locate nfreq frequencies with highest firing rates
% for each cell
%INPUTS:
% MNum = mouse number
% h1 = List of files with extra 0 ammended, but not including filter
% number
% nfreq = number of frequen... |
function yp = naninterp1(x,y,xp,mthd)
% yp = naninterp1(x,y,xp,mthd)
% Works like interp1 but works with NaNs in y (but NOT in x!).
% The interpolated values
yp = NaN(numel(xp),1);
% Set NaN values to some huge number
yy = y;
ymax = max(y(~isnan(y)));
ymin = min(y(~isnan(y)));
if(any(isnan(... |
#include "com_codename1_impl_ios_NSFileInputStream.h"
const struct clazz *base_interfaces_for_com_codename1_impl_ios_NSFileInputStream[] = {};
struct clazz class__com_codename1_impl_ios_NSFileInputStream = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_impl_ios_NSFileInputStre... |
%addAllToPath - This function adds all folders above it to the path
%
% Author: Adam Gaier
% Bonn-Rhein-Sieg University of Applied Sciences (HBRS)
% email: adam.gaier@h-brs.de
% Oct 2017; Last revision: 09-Oct-2017
%------------- BEGIN CODE --------------
% Clean up workspace and add relevant files to path
currentPath... |
function ffgettbl(Sector, BPMFlag, QUADGenFlag)
%FFGETBL - Gets a new insertion device feedforward table
% ffgettbl(Sector, BPMFlag(1=BPM, 2=IDBPM), QUADGenFlag (0-take the old quad table, else){0})
%
% This function generates the feed forward tables necessary for insertion device compensation.
%
% See also fftest, ffa... |
classdef multilinegroup < shapes.linegroup
% Multiple line objects, in varying number, over multiple frames.
%
% This class is used to manage multiple lines that change over times.
% It differs from its parent class, shapes.linegroup, by allowing the
% number of line objects to vary at e... |
function [z,p,k,L,M]=zs2g(A,B,C,D)
disp('funkcja zs2g');
disp(' zamiana zmiennych stanu na z,p,k transmitancji');
disp(' A, B, C, D - znane macierze');
disp(' rownanie stanu w zapisie macierzowym');
disp(' sX(s) = A*X(s) + B*U(s)');
disp(' Y(s) = C*X(s) + D*U(s)');
disp(' X(s) = [x1,x2,x3,...] - wektor zm. stanu'... |
function THRESHOLD_POTENTIAL = getThresholdPotential(KeepScaledResidual,timestamp,THRESHOLD_COEFFICIENT_POTENTIAL)
% clear all
%
% clc
%
%
% A = randn(5,200);
%
% B = randperm(500);
%
% A(B(1:100)) = NaN;
% A(B(110:200)) = Inf;
%
% length(find(isnan(A)==1))
% length(find(isinf(A)==1))
%k ... |
function [ classes ] = test_classifier( classifier, feature_vectors )
% Tests a given classifier
% Predicts the classes for a matrix of feature vectors
display('Getting classes');
% feature_vectors = extract_feature(in_im);
[num_fv, num_points] = size(feature_vectors);
classes = zeros(num_points, 1);
for i = 1:num... |
function Ke = parse(folder, analysis, measures)
n_a = length(analysis)
n_m = length(measures)
data = zeros(n_m,n_a);
for k=1:n_a
filepath = [folder , cell2mat(analysis(k)) , '\' , cell2mat(analysis(k)) , '.csv']
col=fileread(filepath);
rows = regexp(col,'\n','split');
for i=1:length(rows)
st... |
function H = hatch(im,levels,thickness)
% HATCH computes dithering hatched image with a number of levels of specified
% thickness
%
% H = hatch(im,levels)
%
% Inputs:
% im original image
% levels number of hatching levels {3}
% thickness thickness of individual hatch lines
% Outputs:
% H h... |
function showSolutionDemod(par, sampleRate, iq)
symbols = computeSymbolsFromParams(par, sampleRate, iq);
%%
plot(symbols, 'b.', 'MarkerSize', 16);
title('Separated symbols')
xlabel('In-Phase')
ylabel('Quadrature') |
function [clusters, pvals,sigvals] = average_p_cluster(M,minsize,alpha,shuffles)
% For each dimension, cluster the data reducing the variance on this
% dimension and compute the p-value independence test for each variable
% INPUT : M n*p matrix, n samples, p dimensions
% MINSIZE the minimum size for the cluste... |
%The prime factors of 13195 are 5, 7, 13 and 29.
%What is the largest prime factor of the number 600851475143 ?
clear
clc
a=input('Enter a postive number: ');
n=0;
for m=2:a
if rem(a,m)==0
n=n+1;
c(n)=m;
while rem(a,m)==0
a=a/m;
end
end
end
p=max(c);
f... |
function [a_j_minus_half,a_j_plus_half]=aspeedIsolatedAlphaEqnUm(alphal,Um,rhol,rhog,V0,a)
% Gives the max of spectral radius at interfaces for
% Kurganov and Tadmor's kind of schemes
% in simplified mixture problem for isolated alpha equation
%
% d alphal/dt+d(alphal*Um-alphal^a*(1-alphal)*Urlg)/d... |
clear; clc; close all;
settings.mode = 'fitting';
settings_default;
downscaling_factor = 2;
settings.H = 480/downscaling_factor;
settings.W = 640/downscaling_factor;
num_iters = 7;
damping = 10;
%{
From previou5s experience
- Do not set w2 high, it interferes with other energies
- Set w5 quite high
%}
w1 =... |
function Transporter_competition
%% Transporter uptakes.
doublings=2;
Khxt_glc = 1
Khxt_gal = 200;
vmax_hxt = 1;
Kgal2_glc = 2;
Kgal2_gal = 1;
vmax_gal2= 0;
c_max = 1;
gal_res = [-9:0.1:1];
glc_res = [-7:0.1:0];
agal_vec = [ 2.^gal_res]*55;
aglu_vec = [ 2.^glc_res]*55;
[glc_out,gal_out] = ... |
d_results = dir('./results')
for fileIndex = 1:(length(d_results)-2)
fileIndex
d_results(fileIndex+2).name;
[path, name, ext] = fileparts(d_results(fileIndex+2).name);
file = fopen(strcat('./results_name/', d_results(fileIndex+2).name), 'r');
clear A
load(strcat('./results_mat/', strcat(n... |
classdef MatrixBased < handle
%MatrixBased A list of sparse vectors.
% A Java-based implementation of a list of sparse vectors
properties (GetAccess = private, SetAccess = private)
n
data
end
methods
function obj = MatrixBased(n, z)
% Creat... |
function [fitness_value]=Sphere(X)
fitness_value=sum(X.^2);
end |
function [menores,ivector] = dominantes(Cost,menores,i, ivector)
if Cost(1)~=0
[m,~] = size(menores);
if m>=1
j=1;
borrar = [];
count=0;
sw=true;
while j <= m
if (Cost(1) <= menores... |
function f = my_atan(y,x)
% Function calculates the arc tangent of y/x and placees the result in
% range of [0..360]
f = 0;
if x == 0
if y == 0
elseif y > 0
f= 90;
else
f = 270;
end
elseif x > 0
if y >= 0
f = atand(y/x);
else
... |
function b = odd_rms(N)
a = 1:2:N*2;
b= sqrt(sum(a.^2)/N);
end
|
%% Pattern generation
Skeleton=[0 0.05 0.1 0.25 0.5 0.75 0.8 0.9]*44100;
Skeleton=[Skeleton; 220 220 220 380 130 220 220 220];
Skeleton=[Skeleton; 220 220 220 400 80 220 220 220];
Pattern_smooth=interp1(Skeleton(1,:),Skeleton(2,:),0:Skeleton(1,end),'spline');
Pattern_sharp=interp1(Skeleton(1,:),Skeleton(3,:),0:Skeleto... |
function merger(scenarioName,folderPath)
fullPath=[folderPath,'ResultMatrix\',scenarioName,'\'];
Files=dir(fullPath);
numberOfFiles= numel(Files);
mainMatrix=[];
counter=0;
for i=1:numberOfFiles
if ((strcmp(Files(i).name,'.')==0 ) && (strcmp(Files(i).name,'..')==0))
counter=counter+1;
sensorMatrix=l... |
function [Fbar, w_range] = fixed_point_IDE( lam, d, k, delta, g, Gbar, w_range )
%
dw=w_range(2)-w_range(1);
N=length(w_range);
Fbar=zeros(N, 1);
H=zeros(size(Fbar));
Fbar(1)=lam*k*dw*trapz(Gbar)+lam*d*delta;
delta_indx=find(w_range<delta, 1, 'last' );
if isempty(delta_indx)
delta_indx=0;
end
lamddw=lam*d*dw;
lamd... |
function [eps_total, mu_total] =...
PMM_epsilon_ellipse_new(N_basis_x,N_basis_y,Nx,nx,Ny,ny,...
N_intervals_x,N_intervals_y,La,epsilon,...
int_epsmu_xx,int_epsmu_xy,int_epsmu_yx,int_epsmu_yy,int_epsmu_inv_zz)
N_total_x = sum(N_basis_x); %total number of basis functions
N_total_y = sum(N_basis_y); %total... |
clc; clear all;
i=[5 10 20 30 40];
Vd1=[2.08 2.24 2.40 2.72 2.96];
Vd2=[2.08 2.24 2.40 2.56 2.72];
plot(i,Vd1); hold on; grid on;
plot(i,Vd2,'-r');
title('LED 양단의 전압 V_D');
xlabel('전류'); |
function [HKL]=UVWtoHKL(lsfits,UVW,Temp)
%CTERun License
%Copyright (c) 2012, The Kriven Research Group. All rights reserved.
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the following conditions are met:
%1. Redistributions of source code ... |
function PlotSimulation(cellData,mode,panic,visibility)
N = size(cellData,3);
t = zeros(1,N);
for i = 1:N
t(i) = size(cellData{1,1,i},2);
end
M = max(t);
s = zeros(5,M,N);
for n = 1:N
for i = 1:M
for j = 1:5
if i > size(cellData{:,j,n},2)
... |
function index=min_index(arr)
% MIN_INDEX finds the index of minimal element of an array.
[row,index]=min(arr);
end
|
function res=train_net(net,test_data)
test_data = im2single(test_data) ;
%resultados = cell(1,size(test_data,3)) ;
%scores = cell(1,size(test_data,3)) ;
%best = zeros(1,size(test_data,3)) ;
%bestS = zeros(1,size(test_data,3)) ;
for i=1:size(test_data,3)
resultados = vl_simplenn(net, test_data(:,:,i)... |
%% Working with an existing ISMRMRD data set
% This is a simple example of how to reconstruct a single-shot EPI images from data
% acquired on a fully sampled cartesian grid
%
% Capabilities:
% 2D
% use noise scans (pre-whitening)
% remove oversampling in the readout direction
% regridding of EPI traectory
% ... |
function ls=lspline(t,y,x)
% lspline computes the linear spline
% Inputs:
% t: vector, contains sorted knots(increasing)
% y: vector, contains the interpolating values at knots
% x: vector, contains points where the lspline shoule be
% computed
% Output:
% ls: vector, contains the values of lspline at points x
m=lengt... |
accuracies=[]
net = patternnet(30);
for i=1:25
[ trainingSet,trainingLabels,testSet,testLabels ] = div2TrainingAndTestSet( dataSet,dataSetLabels,0.7 );
net = train(net,trainingSet,trainingLabels);
preds= round(net(testSet));
acc = sum(preds(1,:)==testLabels(1,:))/length(preds);
accuracies(i)=acc;
end
disp(['average acc... |
% Name:Tommy Lee Truong
% Last Edit:Sept 8 2020
% Program Name: Homework 2
x=[0,pi/4];
yt=tan(x);
y1=tan(x)+(1+tan(x).^2).*(x-pi/4);
y2=tan(x)+(1+tan(x).^2).*(x-pi/4)+(1+tan(x).^2).*tan(x).*(x-pi/4).^2;
y3=tan(x)+(1+tan(x).^2).*(x-pi/4)+(1+tan(x).^2).*tan(x).*(x-pi/4).^2+(2.*(1+tan(x).^2).*tan(x).^2+(1+tan(x).^2... |
function d = dz_dw(w,p,z,param)
%DOTPROD2.DZ_DW Derivative of weighted input with respect to weight
% Copyright 2012-2015 The MathWorks, Inc.
S = size(z,1);
z1 = w*p;
d = cell(1,S);
for i=1:S
d{i} = bsxfun(@times,2*z1(i,:),p);
end
end
|
function result = InverseJacobiNC( X, K )
%INVERSEJACOBINC Inverse of the Jacobi function NC.
% INVERSEJACOBINC(X,K) is the inverse of Jacobi function NC for
% elements of argument X and modulus K. X and K must all be real and the
% same size or any of them can be scalar.
%
% See also MINVERSEJACOBINC
% I... |
'sitter'
sparse_sitter_practical = 9*ones(N,J);
examinee_record_sitter_practical = zeros(size(theta,1),test_cali);
item_record_sitter_practical = zeros(J,target_sample);
unselect = index_cali;
item_finish = [];
target_p = target_sample/N;
r1 = zeros(length(index_cali),1);
r2 = r1;
r3 = r1;
r4 = r1;
% find target poi... |
function [ dX ] = point_mass_model(x,u,P)
% u : force to x,y,z axis and 0
if isfield(P,'A')
A=P.A;
else
A=[zeros(3),eye(3);zeros(3,6)];
end
if isfield(P,'B')
B = P.B;
else
B = [zeros(3);eye(3)];
end
u = u(1:3);
dX = A*x+B*u;
end
|
classdef EnsambleKnn
properties
size % number of classifiers
frac
C % classifiers
labels % class labels
end
methods
function K=EnsambleKnn(s, data, f)
if nargin < 2
error('Malo vstupnich parametru');
elseif ... |
% Exercise session 4: DMT-OFDM transmission scheme
clear all;
close all;
Nq = 4;
M = 2^Nq;
cpr = 500;
SNR = 25;
fftSize = 2^10;
frameSizeTot = fftSize/2-1;
% ON-OFF Bit Loading
channelSelector = [zeros(25,1);ones(400,1);zeros(86,1);];
%channelSelector = [ones(511,1);];
frameSize = sum(channelSelector);
z=Nq*frameSi... |
function [ channel ] = fillChannel( channel,row,col )
%UNTITLED4 Summary of this function goes here
%If the coldest area is a TSV, fill the surroundding area
%
% divide into the four area
% \ 1 /
% \ /
% 2 \/ 4
% /\
% / \
% / 3 \
% in 1,3 fill by :
% 0
% -1
% 0
% in 2,4 fill by : 0 ... |
function edgecurves = extractedge(inpic, scale, threshold, shape)
% Smoothing the image
smoothened_image = discgaussfft(inpic, scale);
% First order derivative
Lv_start = Lv(smoothened_image, shape);
% Second order derivative zero crossings
Lvv = Lvvtilde(smoothened_image, shape);
% Extra condition that is to be ap... |
str=['r';'k';'b';'y';'g';'c'];
set(0,'DefaultLineLineWidth',1.5)
if unit_spec_var
sepsm=kron(ones(N,1),mean(sepsmc,1));
sepsi=mean(sepsmc(:,ones(1,N))./lambmc,1);
[ssepsi si]=sort(sepsi);
end
gh=figure(double(gcf)+1)
[xa,fa]=dichte(sepsmc);
if unit_spec_var
scatter(sepsi',sepsm*10,4,'o',... |
%%%%%%%%%%%%%%%%%
% Behavioral Reversal Learning Task written by Amanda Buch
% Modified from shopping learning task written by Madeleine Sharp, MD
% in the lab of Daphna Shohamy, PhD at Columbia University
% Last Updated December 17, 2015
%MS: commented out the scanner-relevant bit because can't find getexternals
%or ... |
function display(pop)
% population/display
%
% display(pop)
%
% Display a population.
%************************************************************
%* *
%* vgGA: The Virtual Gene Genetic Algorithm *
%* ... |
function CMAL=nhS(i,P,R,L)
%Neighborhood function that determines the neighbors of particle i taking into
%account the periodic boundary conditions (9 cases) and calculates
%the direction from particle i to the local center of mass of the neighbors.
N=size(P,1); %Number of potential neighbours
AG=zeros(N,3); %To st... |
function [L,K,V] = ctmlda(X,ns,nt,n)
% [L,K,V]=mlda(X,ns,nt,n)
%
% L - Eigenvectors(sorted) of matrix X. Each column represents an eigenvector.
% K - Eigenvalues (sorted) of matrix X. It is a column vector.
% V - Variance explained by each corresponding eigenvalue.
%
% X - Matrix containing the train. set, whose each l... |
clear
clc
% Load FTF data
% experiment = load('FTF_A.mat');
% load FTF_gain_10_new_arc.mat
% load FTF_phase_10_new_arc.mat
load experiment_app.mat
% experiment.gain = GainFDFxyscan(:,2);
% experiment.freq = GainFDFxyscan(:,1);
% experiment.phase = PhaseFDFxyscan(:,2);
N = 250;
experiment_app.phase = -experiment_app.ph... |
function dump_terminals( handle, is_ext_node, node_ids )
if any(is_ext_node)
fprintf(handle, '{ node [shape=doublecircle] ');
for t=find(is_ext_node)
fprintf(handle,'%i ', node_ids(t));
end
fprintf(handle, '}\n');
end
end
|
% generate Pb images for a variety of detectors
iids = imgList('test');
presentations = {'gray','color'};
ignore = mkdir('pb');
for j = 1:numel(presentations),
pres = presentations{j};
ignore = mkdir(fullfile('pb',pres));
end
ignore = mkdir('pb/random');
for iid = iids,
im = rgb2gray(imgRead(iid... |
%% load data
load newdata;
dataset = 12;
trace_means = alldata(dataset).trace_mean;
%% preprocess data
trace_means_in = trace_means';
[T,nroi] = size(trace_means_in);
norm_means = nan(size(trace_means_in));
norm_means_smooth = nan(size(trace_means_in));
x = 700;
p = 5;
e = 30;
b = 100;
filtersd = 4;
for t=1:T
... |
function result = melC( m)
%MCELC Evaluates the complete elliptic integral C.
%
% 1
% | |
% | t^2*(1 - t^2) dt
% C(m) = | --------------------------- = ((2 - m)*K - 2*E)/m^2
% | sqrt((1 - t^2)*(1 - m*t^2))
% | |
% ... |
clc, clear all
Isizes = [121 121 1];
F = [61 61 1];
scales = 1;
rescale = 0;
P = scaleSpaceFeatures(F,scales,rescale);
% P = [300 500 1 1; 800 200 1 2; 250 250 2 1];
gridType = 'log-polar';
gridSize = [8 2];
gridRadius = 30;
centerFilter = 'none';
centerSigma = [1 1];
cellFilter = 'gaussian';
cellSigma = [1 1];
binSig... |
%--------------------------------------------------------------------------
% do preprocessing and feature extraction from raw data
%--------------------------------------------------------------------------
% developed by Ho-Seung Cha, Ph.D Student,
% CONE Lab, Biomedical Engineering Dept. Hanyang University
% under s... |
function jdDpxSeminarCam(rect)
% jdDpxSeminarCam
if nargin==0
rect=[];
end
evalin('base','clear classes webcam');
E=dpxCoreExperiment;
E.clearPlugins();
E.paradigm='';
E.window.set('rectPx',rect,'widHeiMm',[2 2],'distMm',1, ...
'gamma',1,'backRGBA',[0.5 0.5 0.5 1],'s... |
function commTopo = adj2link(commAdj)
m = size(commAdj, 1);
n = size(commAdj, 2);
commTopo = [];
k = 1;
for i = 1 : m
for j = 1: n
if commAdj(i, j) == 1
commTopo(k, :) = [i j];
commAdj(j, i) = 0;
k = k + 1;
... |
function [f_unk_1]=rlse(yk_1,hk_1,G_un,rk)
% Estimate sk_1: A matrix with dimension rxr
Sk_1=inv(G_un'*inv(rk)*G_un);
% Recusive solution for unknown excitation
f_unk_1=Sk_1*G_un'*inv(rk)*(yk_1-hk_1);
|
%A 2D uniform PDF function.
%xrange and yrange are inclusive limits of region
%z is a 2D sample point.
function val = unifpdf_2d(xrange, yrange, z)
minX = xrange(1);
maxX = xrange(2);
minY = yrange(1);
maxY = yrange(2);
evalX = z(1);
evalY = z(2);
if(evalX < minX)
val = 0... |
function Q = JointProb(P,X)
%--------------------------------------------------------------------------
% JointProb computes joint probabilities P(X,Y) from conditional probabilities P(Y|X).
% X,Y are discrete variables over a finite set.
%
% INPUT:
% P : Matrix of conditional probabilities, where P(i,j) = Prob[Y=... |
%% Update counter.trial_num
if (counter.trial_num_time == 0) && counter.trial_num <= num_trials
counter.trial_num = counter.trial_num + 1;
end
|
clear
clc
f1 = @(x,u1,u2) u2; % initial value
f2 = @(x,u1,u2) 2*u1^3 - 6*u1 -2*x^3;
p1 = @(u1) 6*u1^2-6; % initial value
f3 = @(x) x+ 1./x;
a = 1; % initial mesh point
b = 2; % final mesh point
alpha = 2; % initial value of the solution
beta = 5/2;
N = 10;% number of intervals between the mesh points
h = (b-a)/N; % s... |
function result = mJacobiLambda( X, NU, M )
%MJACOBILAMBDA Elliptic Lambda function (Jacobi 2nd form of elliptic
% integral of 3rd kind).
% MJACOBILAMBDA(X,NU,M) is the Jacobi's 2nd form of elliptic integral
% of the 3rd kind of elements of X, NU and parameter M. X, NU, M must be
% real and of the same siz... |
%{
#
employee_id : varchar(12) #
employment_year : int #
%}
classdef Employee < dj.Manual
end
|
function [t,I]=image_difference(V,U,type,Mask,MaskNum)
% This function gives a registration error and error image I between the two
% images or volumes.
%
% [t,I]=image_difference(I1,I2,type,Mask)
%
% inputs,
% I1: Input image 1
% I2: Input image 2
% type: Type of similarity / error measure
% (optional)... |
function scrb=scrb_solution(clv)
%SCRB_SOLUTION computes separable costs-remaining benefits allocation of game v.
%
% USAGE: z=scrb_solution(v)
% output:
% scrb -- A separable cost-remaining benefits allocation of the game v
%
% input:
% clv -- TuGame class object.
%
%
% Author: Holger I. Mei... |
function [ma,Mmc]=min_aspiration(v)
% MIN_ASPIRATION computes the minimum aspiration level of players of game v.
%
% Usage: ma=min_aspiration(v);
%
%
% Define variables:
% output:
% ma -- Minimum aspiration level vector.
% Mmc -- Maximum marginal contribution vector.
%
% input:
% v -- A Tu-Gam... |
function y = nigpdf(x, alpha, beta, mu, delta)
%NIGPDF Probability density function (pdf) for Normal-Inverse-Gaussian distribution.
% Y = NIGPDF(X, ALPHA, BETA, MU, DELTA) returns the pdf of the
% Normal-Inverse-Gaussian distribution with the parameter BETA which
% determines the skewness, shape parameter A... |
fin=fopen('Origin_Version_15000.txt','r');
tline=fgetl(fin);tline=fgetl(fin);
Origin_time=str2num(tline);
fclose(fin);
fin=fopen('Advanced_Version_15000.txt','r');
tline=fgetl(fin);tline=fgetl(fin);
Advanced_time=str2num(tline);
plot([1:size(Origin_time,1)],Origin_time,'.',[1:size(Advanced_time,1)],Advanced_time,'.');... |
function [ xf,yf,h] = boundary( xi,yi,hi,x,y,h)
[ xf,yf ] = refine( x,y );
for ii=1:length(xf)
if xf(ii)~=x(ii)||yf(ii)~=y(ii)
h(ii)= bilinear(xi,yi,hi,xf(ii),yf(ii));
end
end
end
function [ x,y ] = refine( x,y )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
%condit... |
clear;
exact=load('dat1D_Rie_Test_10_X_exact.dat');
numx=load('dat1D_Rie_Test_10_X.dat');
x=numx(18,:);
dx=numx(2,:);
ux=numx(3,:);
px=numx(1,:);
% numy=load('dat1D_Rie_Test_12_Y.dat');
% dy=numy(2,:);
% numz=load('dat1D_Rie_Test_12_Z.dat');
% dz=numz(2,:);
pe=exact(1,:);
de=exact(2,:);
ue=exact(3,:);
plot(x,de,'b',x,d... |
filename='/home/ubuntu/IceOceanVolume/ISOMIP_PLUS/Ocean3/MakeOSF/Ocean3_COM_ROMSUTAS_FISOC_OSF.nc'
PlotName='Ocean3_movie'
%load data
x=ncread(filename,'x');
y=ncread(filename,'y');
z=ncread(filename,'z');
[X,Y,Z]=ndgrid(x,y,z);
time=ncread(filename,'time');
meanMeltRate=ncread(filename,'meanMeltRate');
totalMeltFlux=n... |
close all;
filename=strcat(DATA_FOLDER,'physics_constants.mat');
load(filename);
mr=mDT*mHe/(mDT+mHe);
filename=strcat(DATA_FOLDER,'pressure_profile.mat');
load(filename);
filename=strcat(DATA_FOLDER,'motions_map_dimensions.mat');
load(filename);
filename=strcat(DATA_FOLDER,'TAE_data.m... |
close all;
clear all;
% Choose Images to run the code on
img1 = imread('brain1.png');
img2 = imread('brain2.png');
img1 = imresize(img1,0.3);
img2 = imresize(img2,0.3);
% Storing the original images for reference
im1 = img1;
im2 = img2;
%Calculate the Grayscale values of the image
if size(img1,3)==3
img1 = rgb... |
function [] = output_leaflet_mesh_schematic(valve)
% Copyright (c) 2019, Alexander D. Kaiser
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% 1. Redistributions of source code must retain th... |
function w2c = cut_plot_edep011_Ei1400(en,varargin)
pr = projection([1,0,0],[0,1,0]);
dat = fullfile(pwd,'sqw','data','Fe_ei1371_base.sqw');
w2 = cut_sqw(dat,pr,[0.9,1.1],[-3,0.05,4],[-2,0.05,2],[en-15,en+15]);
bg = cut_sqw(dat,pr,[0.9,1.1],[3,4],[-2,0.05,2],[en-15,en+15]);
if sum(bg.data.npix)>0
bgc = replicate(... |
clear all;close all
global k m1 m2 l l0 d A omega
k=5;l=32;l0=12;d=20;m1=0.01;m2=1;A=1;omega=10;
options = odeset('RelTol',1e-10);
fig1 = figure('Name','Le pendule à double ressort','visible', 'off');
for j=0:0.001:0.002
[t,theta] = ode45(@pendulum_double_ressort,[0:10:1000],[pi/4-j 0 0 0], options);
... |
% Include map
map = SMap.getInstance().getOccupancyGrid();
% Include ROB toolbox
mydir = pwd;
cd('..\..\rvctools') % ROB toolbox + Machine vision !
startup_rvc
cd(mydir)
start = [4.72 1.512];
compLabViaPoints = [
start;
4.72 2.488;
16.92 2.2;
17.92 2.2;];
posCompLab = [17.92 2.... |
% Wave Equation
clear
clc
%% Initial Set up
nx = 64;
ny = 64;
Lx = 1;
Ly = 1;
x = linspace(0, Lx, nx);
y = linspace(0, Ly, ny);
dx = x(2) - x(1);
dy = y(2) - y(1);
c = 0.5;
p = 2;
q = 1;
alpha = 1.4;
sigma = 1/sqrt(2);
gamma = 1/sqrt(2);
dt = sigma*(dx/c);
t = 0:dt:2;
nt = length(t);
%% 2D temperature matrix and Boun... |
function show_figure(figure_name)
switch figure_name
case 'contrast_overlap_GP_EMPA_GLM_102'
% contrast_overlap.m
load(fullfile(get_mat_dir(), 'agg_gp_CV_us=1_glm=1_model=EMPA_theory_nsamples=100_project=1_fast=1.mat'));
tmap_filename = bspmview_save_map(EXPT, tmap);
EXPTs = {vg... |
close all;
clear all;
clc;
parameters_longitudal_autopilot;
figNum = 1;
s = tf('s');
sys = ss(A,B,C,D);
Phi = inv(s*eye(5)-A);
trans = C*Phi*B + D;
% Task 2b
H_evCar = s*(s^2+(a_phi_1 + a_phi_2*k_d_phi)*s + a_phi_2*k_p_phi);
figure(figNum)
%controlSystemDesigner('rlocus',1/H_evCar);
%rlocus(1/H_evCar);
H_phi_open ... |
%4th order Runge-Kutta
clear
clc
a=1;
b=0.5;
q=1;
r=1;
s=10;
T=20;
h=0.01;
n=(T/h);
P2(1)=s;
for i=1:n
k1=h*-(2*P2(i)+q-(b^2/r)*(P2(i))^2);
k2=h*-(2*(P2(i)+1/2*k1)+q-(b^2/r)*(P2(i)+1/2*k1)^2);
k3=h*-(2*(P2(i)+1/2*k2)+q-(b^2/r)*(P2(i)+1/2*k2)^2);
k4=h*-(2*(P2(i)+k3)+q-(b^2/r)*(P2(i)+k3)^2);
P2(i+1)=... |
function [f] = fpt(a,b,c,g)
% Fast Polynomial Transform, based on Potts (1998).
% Basis exchange for orthogonal polynomials that satisfy the three term
% recurrence relation: P[n](x)=(a[n]x+b[n])P[n-1](x)+c[n]P[n-2](x).
% The last input argument, g, should be the coeffients of the linear
% combination of P[n](x) and f ... |
function makeFigure(i,bbox)
% Make a figure and size.
figure(i);
clf;
xlim([bbox(1) bbox(1)+bbox(3)]);
ylim([bbox(2) bbox(2)+bbox(4)]);
hold on; |
clc; clear;
%% Variables needed
B = 11.5*pi/180; %sideslip angle in radians
sweep = 15*pi/180; %sweep angle in radians
Svs = 48.3; %area of the vertical tail extended to the fuselage centerline ft^2
volume = 666.17; %volume of fuselage ft^3
Sw = 312.5; %Area of wing ft^2
Clda = 0.0052; %rolling moment ... |
function rerr=setFieldIntegralError(r0,rerr,indx,order,Nsigma,sigmaperc)
%function rerr=setFieldIntegralError(r0,rerr,indx,order,Nsigma,sigmaperc)
%
%
%see also: ApplyErrorRand
rerr=PadPolynomAB(rerr);
r0=PadPolynomAB(r0);
% original value
try
kl=atgetfieldvalues(rerr,indx,'PolynomB',{1,order});
kl(isnan(kl))=... |
function [symbol_sequence]=bit2symbol(bit_sequence);
%由bit序列symbol序列的转换
global signal;
switch signal.modulation_type
case 'BPSK'
symbol_sequence=bit_sequence;
case 'QPSK'
symbol_sequence=bit_sequence(1:signal.nr_of_symbols)+j*bit_sequence(signal.nr_of_symbols+1:signal.nr_of_bits);%不是很明白
oth... |
classdef HsvPixel
end |
% regenerate Generate new data from an existing cloud
%
% This method generates new cloud data using the current moments and
% correlations.
% >> new=regenerate(object);
% >> new=regenerate(object,'moments'); % same as above
%
% See also Cloud, bootstrap
%
%
% created August 5, 2014 by Daniel Dolan (Sandia Natio... |
%Name :Ali Humadi
%Roll.No:0
clc;
close all;
clear all;
%read the image from file and store it in a variable
a=imread("first.jpg");
% using subplot funcition to show the images
subplot(2,2,1)
% show the original image in first part of figure
imshow(a),title("orignal")
% enhace the contrast by *3
b=a*3;
%... |
function [work] = output_work(Eg,nph)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%outputs the maximum thermodynamic work a photon can do at a given band
%edge in a solar solar and absorbed photon density(equations from Henry, 1980)
%
%To account for concentration C, change all value of nph... |
clc
clear
syms px py pz
syms Tax Tay Taz
syms Fax Fay Faz
%
% px =-0.026;
% py = -0.01;
% pz = 0.046 ;
%
% Tax = (0.0174-0.0148);
% Tay = (0.086-0.067);
% Taz = (0.2106-0.21);
%
% Fax = (-0.438+0.39429);
% Fay = -2.48+2.6;
% Faz = -15.41+13.91;
Ta = [Tax; Tay; Taz];
Fa = [Fax; Fay; Faz];
a = [0 -pz py;
pz 0... |
function [ output_args ] = plot_d( data,label,i )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
s1 = ['figure(),subplot(211),plot(data.f',num2str(i),'); hold on;grid on;title(''The flow signal of SUBJECT',num2str(i),''');'];
s3 = ['subplot(212),plot(data.Sp',num2str(i),'); hold on;grid... |
function signal_analog = DAC(signal_digital, Nd, Nz, cyclic_part, interp_factor)
% Function interpolates signal by interp_factor.
% It uses frequency characteristic of the OFDM signal and adds zeros to both sides of the characteristic.
% Then it uses IFFT algorithm to return interpolated time domain signal.
% PRBS is i... |
function [LRes,ZRes,SRes,RRes,G] = applyGBR(ZGT,RGT, ZGBR, LGBR, SGBR, RGBR, mask)
[G, ZRes] = getGBR(ZGT,ZGBR, mask);
LRes = LGBR*G';
SRes = my_normr(SGBR/G);
%SRes = my_normr(G\SGBR')';
RRes = RGBR .* sqrt( sum((SGBR/G)'.^2) ./ sum(SGBR'.^2))';
%RRes = RGBR .* sqrt( sum((G\SGBR').^2) ./ sum(SGBR'.^2))';
... |
function [ wynik ] = cztery2( A,b,x0 )
%diagonalna=diag(A)
%diagonalna1=diag(A,-1)
%diagonalna2=diag(A,1)
B = tril(A)
%maxiter=1000;
%dokl = 1e-8;
n=size(A,1)
%resJ(1) = norm(b);
%roznica=999
%xJ = zeros(n,1)
xJ=x0;
jed=eye(n)
k=2
%while ((k < maxiter) && (roznica > dokl))
%y=B\((B-A)*xJ+b)
y = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.