text stringlengths 8 6.12M |
|---|
% 来玩一玩文件的读写
% [支持的导入和导出文件格式 - MATLAB & Simulink - MathWorks 中国](https://ww2.mathworks.cn/help/matlab/import_export/supported-file-formats.html)
filename = 'ex15_sample.txt';
fileID = fopen(filename);
txt1 = textscan(fileID, '%c');
txt2 = textscan(fileID, '%s');
disp(txt1)
disp(txt2)
txt3 = textscan(fileID, '%c', 10... |
clear
clc
close all
%% Question 1 -- Part A
A1 = [ 0, -sqrt(3);
-sqrt(3), 2];
[A1pos, A1neg] = upwind_decompose(A1);
% confirm that A1 = A1pos + A1neg
A1
A1pos + A1neg
% define and decompose A2
A2 = [ 1/4, -3*sqrt(2)/4, 9/4;
-3*sqrt(2)/4, 5/2, -3*sqrt(2)/4;
... |
function [fstReachMat, fstSndReachMat, fstSndReachMat_lowTri] = GetFstSndReachMat(lblImg, supNum, setDiagEleZero)
% FUNCTION: Get the first and second order reachable matrix
% INPUT:
% lblImg -- superpixel labels
% supNum -- superpixel number
% setDiagEleZero -- 'true' is to set diagna... |
% general purpose second order switched cap SigDelta ADC
OSR = 500; % fb = 1KHz,Fs = 1MHz
filter_order = 2;
NTF = synthesizeNTF(2,500,0,2);
form = 'CIFB';
[a,g,b,c] = realizeNTF(NTF,form);
b(2:end) = 0;
ABCD = stuffABCD(a,g,b,c,form);
[ABCDs umax] = scaleABCD(ABCD);
fprintf('Coefficients for the second order filter \n... |
% Domain extension
xleft=0;
xright=7.5;%1;
% Cross sectional areas
S=1; %0.02;
% Physical paramaters
rhol=1000;
mul=0.001;
rhog=1; %930; %1;
dp=0.005; %
g=-10;
% Relative velocity model (1: UADE, 2: Schiller-Naumann)
VpqModel=1;
% UADE model Vpq=V0.*((alphaMax-min(alpha.internal,alphaMax))/alphaMax).^a
V0=2.75*4;%... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
% Relationship between DFT and DTFT.
n=0:7;
x=0.9.^n;
syms w
Xdtft=sum(x.*exp(-j*w*n));
N=8;
k=0:N-1;
wk=2*pi*k/N;
XXdtft=subs(Xdtft,w,wk);
XXdtft.'
X=fft(x)
X.'
|
%% clear
clear all;
close all;
clc;
%% Ps n FT error [rad] BL error (n = 1) [rad] FT error - normalized BL error - normalized
data_set = [...
0.1 2 0.8686 0.8305 0.0715 0.0065;...
0.2 2 1.0188 0.8808 0.0838 0.0069;...
0.3 2 1.2113 0.9902 0.0996 0.0078;...
0.4 2 1.3712 1.2643 0.1128 0.0099;...
0.5 2 1.7217 2.4933 0.141... |
function [u, uu, erriter, i, timet] = CMF_ML_Cut
%%
% Performing the continuous max-flow algorithm to solve the
% 2D continuous-cut problem with multiple labels (Potts Model)
%
% Usage: [u, uu, erriter, i, timet] = CMF_ML_Cut;
%
% Inputs: there is no input since all data and parameters can be
% a... |
function [MRC ZF MMSE] = Dnointercell(d,link)
disp('Running simulation ....')
Nt = 4 ;
N0 = 1; %watt
pl = 3; %path loss exponent
shadow_var = 8; %shadow variance
[users num_users, ant] = drop_users_ant(Nt);
Nr = num_users ; %assume all users haveone antenna each
rho = 1; % can assume ... |
% Maximum thrust from all thrusters combined (N)
Tv = 1494.7;
% Mass of lander (initial)
m = 200;
% State-space matrices
% STUDENTS - Enter A and B matrices as they appear in the handout
A = [ ;
];
B = [ ;
];
% Desired pole locations
% STUDENTS - Put the desired eigenvalue locations here
% ... |
function nx = dimension(obj)
%DIMENSION Returns the dimension of the given hyperrectangle.
% nx = dimension(H)
%
% Returns the dimension of the given hyperrectangle H.
%
% (C) 2011 by Truong X. Nghiem (nghiem@seas.upenn.edu)
nx = obj.dims;
end
|
close all; clear all; clc
load('train_data.mat');
theta_init = zeros(9, 1);
num_iters = 700;
alpha = 7.5e-3;
lambda = 1;
% [train.theta, train.J_history] = gradientDescentMulti(train_data.normalized_inputs, ...
% train_data.normalized_young,...
% ... |
function [d, indices, newIndices]=findDressersWithVoxelizing()
load('compsSideViewsAll')
load('compsHeightViewsAll')
load('../../dataStructureForStatistics/bedrooms_2_with_dist_nametags.mat')
tic
j=0;
distToGround=zeros(0, 1);
sizes=zeros(0, 3);
distsToWalls=zeros(0, 4);
indices=zeros(0,1);
% clear comps;
... |
function [model] = leastSquares(X,y)
% Compute sizes
[n,d] = size(X);
% Add bias variable
Z = [ones(n,1) X];
% Solve least squares problem
w = (Z'*Z)\Z'*y;
model.w = w;
model.predict = @predict;
end
function [yhat] = predict(model,Xhat)
[t,d] = size(Xhat);
Zhat = [ones(t,1) Xhat];
yhat = Zhat*model.w;
end |
clc;
clear ;
Length=input('Length of transmission line in km\n ');
if ~(Length > 80&& Length <= 240)
disp('the line can’t be solved by medium model ');
return ;
end
r=input('Per km resistance in ohm\n ');
x=input(' Per km reactance in ohm (x) \n ');
y=input('Per km suspectance in Siemens (y) \n ');
Vl=input('receiv... |
function x = mmlxy(y)
% Checks for number from editable test window, and
% Returns (ceiling) integer (x) (also to window)
% Writes ERR to editable test window if NAN
z = get(y, 'String') ;
x = str2num(z) ;
if isempty(x) ;
set(y, 'String', 'ERR',...
'BackGroundColor','red') ;
else ;
x = ceil(x) ;
s = num2str(x,4... |
function [cyclesData,cyclesDataMean] = mySignal2Cycles(signal,cycleLocs,dataLength)
numSigDimensions = ndims(signal);
if numSigDimensions < 3
signal(:,:,1) = signal;
end
numCycles = size(cycleLocs,2)-1;
cyclesData = zeros(numCycles,dataLength,numSigDimensions);
figure,
for signalDimenstionInd = 1:numSigDim... |
function [R,T] = extract_rbm_d(model)
% extract rules from RBM with label
% using discriminative nature of the model
% hidB: hidNumx1
RW = [model.W' model.hidB];
R.c = zeros(1,size(RW,1));
R.r = zeros(size(RW));
for i=1:size(RW,1)
[R.c(i) R.r(i,:)] = extract_rule(RW(i,:));
end
[lNum,pNum] = size(model.U);
for i=... |
fl_nm = 'D:\Josh\Matlab\cmeAnalysis_movies\good_bricks\160603_bsc_brick_squish\orig_movies\004';
load([fl_nm '.mat'],'Threshfxyc');
tmpst = fxyc_to_struct(Threshfxyc);
tmpst = slope_finding(tmpst,2,400);
%%
mov_nm = [fl_nm '.tif'];
ml = length(imfinfo(mov_nm));
nt = length(tmpst);
[xpos,ypos,sl] = deal(cell... |
function playSound(status)
if strcmp(status,'open')
filename='opendoor.wav';
elseif strcmp(status, 'half')
filename='halfopen.wav';
elseif strcmp(status, 'closed')
filename='doorclosed.wav';
end
[y,Fs] = audioread(filename);
sound(y,Fs);
end |
function [f,g] = OF2_Cost(vy,opstr)
% REF: Springer Protocols (example 2)
idx = opstr.idx;
par = opstr.par;
n_real = opstr.n_real;
n_int = opstr.n_int;
x = vy(1:n_real);
y_int = vy(n_real+1:n_real+n_int);
y_bin = vy(n_real+n_int+1:end);
y = [y_int;y_bin];
k = par.value;
for ii=1:1:size(idx,2)
... |
function perm_mat = perm_affinity(adj,labels)
n = size(adj,1);
deg = sum(adj,2);
twicem = sum(deg);
m = twicem/2;
clusters = unique(labels);
k = length(clusters);
perm_mat = zeros([n,k]);
for v = 1:n
for i = 1:k
c = clusters(i);
labels_copy = labels;
labels_copy(v) = c;
mem = find(labels_copy==... |
function [] = saveData(filename,X,labels,format,flag)
if nargin < 4 || isempty(format)
format = '%6.4e';
end
if nargin < 5 || flag
f = fopen(filename,'w');
if nargin >= 3
for i = 1:size(X,2)
fprintf(f,[labels{i} '\t']);
end
fprintf(f,'\n');
end
for i... |
function v = sorOne(y,pq,v,a)
% v(1)=v(1) already
%% Iterate through gauss for each row in the matrix, add the difference between the output and the input multiplied by an acceleration constant to the input and store in the input for the next row(SOR, Gauss Seidel Accelerated)
for n=2:size(y,1)
v(n)... |
set(0,'defaultAxesFontName', 'Palatino')
set(0,'defaultTextFontName', 'Palatino')
set(0, 'DefaultTextFontSize', 14);
set(0, 'DefaultAxesFontSize', 18);
set(0,'defaultaxeslinewidth', 0.7, 'defaultlinelinewidth',2,'defaultpatchlinewidth',0.7)
format long
|
%%
function res_out=compute_class_distance_v2(res)
res_out=res;
% append the 0th level
within_class_ids=cat(2,[1:length(res.class_id)],res.hierarchical_class_ids);
between_class_ids=cat(2,res.hierarchical_class_ids,[1:length(res.class_id)]*0+1);
% for efficientcy convert within class and between class to uint32
%wit... |
% A= [0 1 0 0 0;
% 0 0 1 0 0;
% 0 0 0 1 0;
% 0 0 0 0 1;
% -1 -2 -3 -4 -1];
% B = [0 ;1; 0; 1;0];
% C = [1 0 2 0 0];
% D = 0;
% [num,den] = ss2tf(A,B,C,D);
% G = tf(num,den)
%
% % =====================================================================
% % s=tf('s')
% % G=((s^2+3000)*(s^2+1000... |
function neutral_pma = neutral_partialsMeanAmplitude(feature_structure)
idx = find(strcmp('partialsMeanAmplitude',feature_structure.names));
pos = find(feature_structure.positions==idx);
neutral_pma = zeros(1,length(pos)); |
function [uav, nextBroadcast] = dowhileinwaiting(uav,broadcast,nextBroadcast,Rmin)
% function to accept invitation and become part of coalition if invited or
% return to search mode
psi = uav.Heading;
V = uav.Velocity;
x = uav.Position(1);
y = uav.Position(2);
if uav.InvitationWaitTime == 1
iB... |
function [h] = getHsvHist(im);hsvim=rgb2hsv(im);
[r,c]=size(im);incr=r*c/4;newhsv=reshape(hsvim,[r*c,3]);
sn={[1,r*c];[1,incr];[incr+1,2*incr];[2*incr+1,3*incr];[3*incr+1,4*incr]};
for i=1:5
startx=sn{i}(1);stopx= sn{i}(2);hsvim=newhsv(startx:stopx,:);
h(i,:)=[hist(hsvim(:,1),8), hist(hsvim(:,2),4), hist(hsvim(... |
clear all;clc;close all
warning('off')
mi = 398600;
orbital_parameters_1.a = 12000;
orbital_parameters_1.ecc = 0;
orbital_parameters_1.theta = 120*pi/180;
orbital_parameters_1.RAAN = 0;
orbital_parameters_1.PA = 0;
orbital_parameters_1.INCLI = 0;
orbital_parameters_2.a = 9500;
orbital_parameters_2.ecc = 0.3;
orbital_... |
function [ afValues, afTimes ] = GetForecastFromMatFile( tRequestedSignal )
%
% initialization
afValues = [];
afTimes = [];
tSignalsIDs = Signal.GetSignalsIDs();
tDevicesIDs = Signal.GetDevicesIDs();
%
try %
%
if ( tRequestedSignal.iSignalID > tSignalsIDs.iForecastedOccupancyCurrent && tRequestedSignal.i... |
%% function [xHat, pp] = interp_poly_v2(tVec,xVec,tOut)
%%---------------------------------------------------------------
%% Program to interpolate the peak of the sinusoid
%%
%% (C) MMRFIC Technology Pvt. Ltd., Bangalore INDIA
%%---------------------------------------------------------------
%% Version History: (in re... |
function loadAndStoreMarkedData2Dir(dirPath, maskSuffix, outSuffix)
%Dla wszystkich plików w katalogu ładuje plik oraz maskę.
%Następnie wycina z wczytanych danych punkty odpowiadające masce i zapisuje je do pliku.
f = dir([dirPath '*.txt']);
noOfFiles = length(f);
for fileNo = 1:noOfFiles
dataPath = [dirPa... |
% total self noise in a 7-pole anti-alias filter
N0 = 2.3*30 ;
N1 = 17 ;
[v1,f] = sak_noise(413,2903,3.3e-9,1e-9,1);
n1 = v1(:,2)*N1 ;
n1_0 = v1(:,1).*N0 ;
n1t = n1 ;
N2 = 9.5 ;
v2 = sak_noise(973,3425,3.3e-9,470e-12,1,f);
n2 = v2(:,2)*N2 ;
n2_0 = v2(:,1).*n1_0 ;
n2_1 = v2(:,1).*n1 ;
n2t = sqrt(n2.^2+(v2(:,1).*n1t).^... |
%Fonction permettant de calculer la valeur du A critique pour l'apparition
%des oscillations en fonction des differents parametres du systeme
% alpha et beta sont les coefficients de l'equation caracteristique :
% lambda+alpha+beta*exp(-lambda A)
% B est defini comme f'(R*)R*+f(R*) ou R* est l'equilibre
% Le... |
function z = mp(U, x, sigma, rc_min)
l = size(U,2);
z = zeros(l,1);
r=x;
rc_max = max(abs(r'*U));
while (norm(r) > sigma*norm(x)) && (rc_max > rc_min)
[rc_max,d] = max(abs(r'*U));
u_d = U(:,d);
z(d) = z(d) + u_d'*r;
r = r - (u_d'*r)... |
% mglMake.m
%
% $Id$
% usage: mglMake(rebuild)
% by: justin gardner
% date: 05/04/06
% copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
% purpose: rebuilds mex file, with no arguments checks
% dates to see whether it should rebuild. With
% reb... |
function circumference = cell_circumference(l,C,V);
%calcualtes the circumference of cell l, connectivity given by C and vertex
%locations given by V
vertex_list = C{l};
circumference = 0;
nk = length(vertex_list);
for i = 1:nk
circumference = circumference + norm(V(vertex_list(mod(i,nk)+1),:)-V(vertex_list(i),:));... |
function [ p ] = explained_variance( L, Var )
%EXPLAINED_VARIANCE Function that returns the optimal p given a desired
% explained variance. The student should convert the Eigenvalue matrix
% to a vector and visualize the values as a 2D plot.
% input ---------------------------------------------------------------... |
function W = get_W_fineedge_BCs( W, glev, grid_parms )
%BC's for W from coarser grid needed on current grid
m = grid_parms.m; n = grid_parms.n; mg = grid_parms.mg;
len = grid_parms.len;
nrows = grid_parms.nrows;
ncols = grid_parms.ncols;
%Define vorticity indices on coarse grid that correspond to bottom, left,
%ri... |
N=70;
n=[1:N];
x=[1.02,0.53,1.3,0.84,1.4,0.85,1.5,1.5,1.43,1.8,1.27,1.19,1.39,1.43,1.5,1.35,1.18,1.39,0.93,1.57,0.91,1.33,0.55,1.59,0.7,0.5,0.7,0.89,0.78,1.2,1.06,0.9,0.92,1.21,0.7,0.51,0.97,0.78,0.58,0.6,1.42,0.81,1.3,0.94,1.4,1.57,1.64,1.65,1.23,1.25,1,0.92,1.68,0.88,1,2,1.12,1.29,2.1,0.55,0.51,0.72,0.86,0.98,1.45,0.... |
function [Kp,Kd]=getPdFromResponse( Wn, damping, varargin )
% for 1/s2+2wn Zeta * wn2 = 1/s2 + Kds + kp
Ka=optFill( varargin, 'Ka',1 );
Kp=Wn.^2 ./ Ka;
Kd=2.*damping.*Wn ./Ka;
|
n = 100;
x = 3 * (rand(n, 2) - 0.5);
radius = [x(:, 1).ˆ2 + x(:, 2).ˆ2];
y = (radius > 0.7 + 0.1 * randn(n, 1)) & (radius < 2.2 + 0.1 * randn(n, 1));
y = 2 * y -1;
|
function setParamsfullP2X7(x)
global k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 L1 K4 L3 H1 H2 H3 H4 H5 H6 H7 g12 g34 E12 E34 A V n rd K1 K2 K3 g34 L2;
k1=getParam('k1',x);
k2=getParam('k2',x);
k3=getParam('k3',x);
k4=getParam('k4',x);
k5=getParam('k5',x);
k6=getParam('k6',x);
k7=getParam('k7',x);
k8=getParam('k8'... |
clear all
clc
%Simulação para análise das médias pós falta
%Autor: Guilherme Lopes
%Universidade Federal do Piauí
mat = '.mat';
faltas_polo_polo = './faltas_polo_polo/';
faltas_polo_terra = './faltas_polo_terra/';
cont = 1;
Ib = (20/23)*1e+03;
%Calculo das médias pós falta Polo Polo
for localizacao = 5:5:195
fo... |
function [BusActors1,BusActors1Actors] = BusActorsSetup(MaxNumActors)
% -------------------------------------------------------------------
% Generated by MATLAB on 5-Mar-2021 10:31:11
% MATLAB version: 9.10.0.1588741 (R2021a)
% -------------------------------------------------------------------
... |
function [ sync ] = arnTongue( dataStruct, targets, coherence_measure, cohInd, dependent_vars, clusts )
% ARNTONGUE function that loops through all entries in dataStruct and plots arnold
% tongue between 2 target regions, i.e. their respective coherence measure
% in dependence of dependent_vars
% Input Parameters:
% ... |
clear all,clc
% In this DEMO_SCRIPT advection equation is solved
% g(t), f(x)and h(x,t) in advection equation.
% More explanation%%% Exercise 11.2a Globals1D;
% Order N of polymomials used for approximation
N= 4;
Elements= 6;
% Generate simple mesh
[Nv, VX, K, EToV] = MeshGen1D(0.0,2.0,Elements);
% Initia... |
function ll = constraintLogLikelihoodLDANeg(model,X)
% CONSTRAINTLOGLIKELIHOODLDANEG Constraint loglikelihood LDA Neg model
% FORMAT
% DESC Returns loglikelihood for constraint
% ARG model : fgplvm or sgplvm model
% ARG X : Latent locations
% RETURN ll : Returns loglikelihood
%
% SEEALSO :
%
% COPYRIGHT : Carl Henrik ... |
function err = WarpError(mu,seqs)
N = length(seqs);
d = 0;
for i = 1:N
tmp = GrassSeqDist(mu,seqs{i});
d = d + tmp*tmp;
end
err = d;
|
function TestEMMPerfect()
Test(10,'M10.csv');
Test(125,'M125.csv');
Test(1000,'M1000.csv');
end
function Test(M,SaveFile)
fid = fopen(SaveFile,'wt');
n = 5;
a = [0.0001,0.00005,0.00001,0.000005, 0.000001];
NEM = zeros(n,1);
E = zeros(n,1);
d = zeros(n,1);
for i=1:n
[EM,NEM(i),E(i),d(i)] = EMMImpedance1(a(i),M); ... |
function [S1, S2] = slices_sanity_check(S1, S2)
if all(S2(:,end) == S1(:,end)) % if blended, you want one less element there.
S2 = S2(:,1:end-1);
end
if all(S2(:,1) == S1(:,1)) % if blended, you want one less element there.
S2 = S2(:,2:end);
end
end |
function [isRed] = findRedBlack(image,regions, props)
%FINDREDBLACK Given an image, its associated regions struct from
%regionprops, and its property matrix, this function will return 1 if the
%image is a red card and 0 if it is black card.
% This funciton converts the image into a normalized RGB image and then
% s... |
% -------------------------------
%% Path tracking error
% -------------------------------
discretization_factor = 0.1;
[x_route,y_route] = vehRoute.evaluate(0:discretization_factor:vehRoute.length);
% Error between real and desired trajectories
desired_path = [x_route' y_route'];
% Prepare an array to store all the mi... |
function [x_Jtorso_e] = Jtorso_e(x)
x_Jtorso_e=[0.,0.,1.,0.,0.,0.,0.];
|
classdef FDChan < matlab.System
% Frequency-domain multipath channel
properties
% Configuration
carrierConfig; % Carrier configuration
waveformConfig; % Waveform configuration
% Path parameters
gain; % Path gain in dB
dly; % Delay of each path in se... |
function [p,c]=amcf(xd,yd,b,r) %ajuste minimos cuadrados para cualquier funcion generica
%b tiene que entrar como string...base de funciones por las que quieres
%ajustar
n=size (b,1); %numero de funciones por las que se ajusta
for i=1:n
B(i,:)=subs(b(i,:),'x',xd);
end
G=B*B.'; %matriz de coeficientes
... |
function [ scaledPhantom ] = resizePhantom( inputPhantom, dimensions )
%RESIZEPHANTOM Resize "inputPhantom" to "dimensions" using nearest-neighbor interpolation
%
% Copyright 2015 Joseph V Rispoli
% 2015/04/14
%
% Input variables
% inputPhantom: three-dimensional (x/y/z) int8 array of phantom
% dimensions: three-... |
function [expanded error] = pedigree2genotype(pedigree, all_data)
error = 0;
[nind, cols] = size(pedigree);
if( nind <= 0 || cols < 12 )
error = 1;
disp('error in pedigree data');
return;
end
genotype = all_data.genotype;
[nloc, fields, c] = size(genotype);
if( ... |
function zombiesInDenmark4()
%% Exact stochastic Simulation - Direct Method (Gillespie)
% 1. Initialize
inp = load('DenmarkMapWithInhab.mat');
inp2 = load('adjacencyMatrix.mat');
adjMat = inp2.spar_adjacency_matrix;
%numAdj = nnz(adjMat);
%[rowsAdj, colsAdj] = find(adjMat);
data = inp.data;
numInhab0 = [data{4,:}];
%... |
set(0,'DefaultAxesFontName', 'Arial');
set(0,'DefaultAxesFontSize', 12);
% Change default text fonts.
set(0,'DefaultTextFontname', 'Arial');
set(0,'DefaultTextFontSize', 12);
intensities = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
dt = 0.1;
%RS IB FS LTS
a = [0.02;0.02;0.1;0.02];
... |
function [dsc] = computeDiceScore(A, B)
intersect = (A & B);
union = (A | B);
d = sum(union(:));
a = sum(intersect(:));
b = sum(A(:));
c = sum(B(:));
dsc = 2 * a / (b + c) * 100;
end |
function master_root = ottBari2020_root()
% where are the Data and MatlabScripts folder located?
master_root = 'C:\FolderContaining_Data_';
|
function Point = local2cart(pointloc,DIP,PIP,MCP,Param)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
hand = Param.hand;
l2=hand(2);
l3=hand(3);
l4=hand(4);
r1=hand(5);
r2=hand(6);
r3=hand(7);
r4=hand(8);
R1=hand(9);
R2=hand(10);
R3=hand(11);
coordnum=pointloc(3);
if (coordnum==2)||(c... |
function [F, P, S_dB, f] = findPeak (s, Fs, thresh, F0, F1)
%
% function [F, P, S_dB, f] = findPeak (s, [Fs, thresh, F0, F1])
%
% To find revelant frequencies in a signal 's'.
% 'Fs' = sample frequency (2 per default)
% 'thresh' = threshold in dB over which a frequency is considered
% as revelant (... |
function varargout = game(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @game_OpeningFcn, ...
'gui_OutputFcn', @game_OutputFcn, ...
... |
orgn = imread('lena.bmp');
mark = load('whataremarks.mat');
mark = mark.w;
watermarked = WatermarkingType1(orgn,mark);
imwrite(watermarked,'watermarked.bmp')
values = zeros(1,100);
%values(1) = dwtsvd_detection('lena_gs.png','watermarked.png','watermarked.png');
max = 0;
for i=(2:1000)
rndw = randi([0,1],1024);
... |
clear all
close all
clc
L_def = 1.15; % change to zero for force control
Ftarget = 2e-8;
rad = 80e-9;
init_len = 1.1;
G1=3*1.1111e-3;
G2=10e6;
G3=3*0.8333e-3;
G4=10e6;
E=700e6;
fib_rads = rad;
init_lens = init_len;
M=5;
k=0.5e-3;
c = 0.5e9;
time(1)=0;
for t = 1:6000
area = pi()*rad^2;
if L_def == 0
... |
function DA = SysMtx(k,mask,Nc,b1,dt,tb0,b0,Positions)
%for single channel only now!
Nt = size(k,1);
Ns = numel(b1);
PulseDuration = dt*(Nt-1);
b0 = b0.*repmat(mask,[1 1 Nc]);
b0 = permute(b0,[3 1 2]);b0 = b0(:,:).';
b0 = b0(mask,:);
b0 = conj(b0);
Dr = diag(b1);
GAMMA = 42.577E6; % in Hz/T
m0 = 1;
AA = zeros(Ns, Nt... |
% MERC - ADDA Toolbox
%
% Version 1.0 - Feb. 2000
%
% Conversion functions
%
% a2d2 - Analog to digital conversion
% d2a2 - Digital to analog conversion
%
% Special functions
%
% fac - faculty n!
% over - conditional faculty n!/k!/(n-k)!
% choose ... |
% Generate Mersenne Twister Sequence of Random Numbers:
rand('twister',1)
r = rand(10^6,1)
csvwrite( "ran3.csv", r)
% Reproduce Intraday Price Path using default parameters and appropriate seed
rand('twister',1)
p=PreisModel(N_A = 125, delta = 0.025, lambda_0 =100, C_lambda = 10,
delta_S... |
%Emily Schultz
%ess2183
%COMS4281
%HW2 - Exercise 4 Program
%Due: 3/5/13
% get epsilon (error)
E = input('Epsilon: '); % Typically 10E-4;
% get matrix (unitary and 2x2)
U = input('Input Matrix: ');
c_mat = eye(2) - U^2; %The norm of I - U^2 is an upper bound for e(C1, C2)
if norm(c_mat) > E
disp('NO'); % The cir... |
%% Multi files plots
namestring = 'yu\quarternion_ref\yu_';
namestring1 = '_ref_q.csv';
std_x = [];
std_y = [];
std_z = [];
mean_x = [];
mean_y = [];
mean_z = [];
for st = {'call1','hand1','t1','b1'}
string = char(st);
filename = [namestring string namestring1];
data = cs... |
function[resultVec] = stretchVec(vec1 num)
resultVecLen = round(num .* length(inVec) );
indx =round(linspace(1, length(vec1), resultVecLeng))
resultVec = vec1(indx)
end |
function varargout = GUI_Dipole_Input(varargin)
% GUI_MAIN MATLAB code by Edi Suprayoga
% feel free to contact me at suprayoga.edi@gmail.com
% last edit 16 Mar 2016
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_Op... |
function doComputeIlluminationDistance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2006-2007 Jean-Francois Lalonde
% Carnegie Mellon University
% Do not distribute
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
addpath ../;
setPath;
% define the path... |
function [options] = IPOPToptions(obj)
% I suggest changing the memory allocation based on the
% complexity/dimension of the mechanical system
arguments
obj (1,1) NLP
end
options = struct;
options.ipopt.mu_strategy = 'adaptive';
options.ipopt.max_iter = 1000;
options.ipopt.tol = 1E-3;
options.ipopt.linear_solv... |
function color_rgb = linen
color_rgb = {'color', [0.98039, 0.94117, 0.90196]};
end |
function particles = beacon_localization(dataStore, particles, beaconLoc, beacon_size, func_gt)
beacon_num = size(dataStore.beacon, 1) - beacon_size;
beacon_idx = dataStore.beacon(end-beacon_num+1:end, 3);
beacon = dataStore.beacon(end-beacon_num+1:end, 4:5)';
func_htBeacon = @(pose) hBeacon(pose,... |
function result = _a (node, elem, ne)
result(1,1) = node(elem(ne,2),1)*node(elem(ne,3),2)-node(elem(ne,3),1)*node(elem(ne,2),2)
result(2,1) = node(elem(ne,3),1)*node(elem(ne,1),2)-node(elem(ne,1),1)*node(elem(ne,3),2)
result(3,1) = node(elem(ne,1),1)*node(elem(ne,2),2)-node(elem(ne,2),1)*node(elem(ne,1),2)
endfunct... |
function [data,IntlvBit] = Polar_Encode(K,N,crcLen,PolarParam,channelIntlv,CRCEncObj)
%% 函数功能:
% 生成随机数据流,添加CRC,并进行Polar编码及相应的速率匹配
%% 输入参数:
% K:生成信息位长度
% N:编码比特速率匹配输出长度
% DLUL:上下行标志,1表示下行,0表示上行
% crcLen:CRC长度
% PolarParam:Polar码参数
% channelIntlv:信道交织参数
%% 输出参数:
% data:原始信息比特
% IntlvBit:编码输出
%% Modify history
% 2018/1/31... |
function y_out = nn_spatialConvolutionMap_Matlab_fast(y, bias, weight, dH, dW, connTable)
[kH, kW, nOutputPlanes] = size(weight);
[h,w,nInputPlanes] = size(y);
h_out = floor( (h-kH) / dH) +1; %% check this
w_out = floor( (w-kW) / dW) +1; %% check this
y_out = zeros(h_out, w_out, n... |
% % addpath('g:\matlab project\m files');
% addpath('/media/tmtb/LinuxDrive/matlab project/m files');
%
% % tt = mtbi_extraction('chb02_16.edf(1).mat', 33280+1, 76801);
% % tt = mtbi_extraction('chb01_03.edf(1).mat', 76801+1, 76801);
tt = mtbi_extraction('chb18_29.edf(1).mat', 76801+1, 18689);
%
% tt = [1,2,3,4];
% f... |
classdef Robotarium < ARobotarium
% Robotarium This object represents your communications with the
% GRITSbots.
%
% THIS CLASS SHOULD NEVER BE MODIFIED
properties (Constant, GetAccess = public)
% This should probably be set through environment variables.
config = jsondecode(char(... |
function ellipse2011(inputname)
if ~exist('inputname', 'var')
inputname=input('Enter the input filename including path (excluding .json): ','s');
end
if regexp(inputname, '\.json$')
inputname = inputname(1:end-5);
end
filename = [inputname '.json'];
if ~exist(inputname, 'dir')
mkdir(inputname);
end
outputnam... |
clear all
close all
hdl = load('handel');
y = hdl.y;
a = y(1 : 10000);
b = zeros(1, 4999);
b(end + 1) = 0.05;
b(1) = 1;
% b = [300 200 100];
c = conv(a, b);
sound(c);
|
%MODEL NODAL ANALYSIS
% JASON PRASAD 100196970;
% define all intial paramters Resistance to Conductance
r_0= 1*10^3
r1=1;
r2=2;
r3=10;
r4=0.1;
g_0=1/r_0;
g1=1/r1;
g2=1/r2;
g3=1/r3;
g4=1/r4;
%initialize remaining paramteres for the circuit
cap=0.25
alpha=100;
l=0.2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
% -*- matlab -*-
%
% x: array(1,K)
% p: scalor
function val = gamma_multivariate_ln(x,p);
% x must be more than (p-1)/2
% x should be more than p/2
% Gamma_p(x) = pi^(p(p-1)/4) prod_(j=1)^p Gamma(x+(1-j)/2)
% log Gamma_p(x) = p(p-1)/4 log pi + sum_(j=1)^p log Gamma(x+(1-j)/2)
K = length(x);
gammaln_val = gammaln(ones... |
%Lauren Ramsey
%LU Factorization Algoritm
function [P, L, U] = luFactor(A)
%"fuFactor" function is an algorithm that outputs the LU facotrization and
%pivoting matrix of an inputed matrix [A] to solve a system of equations.
% The inputs are : "A", which is a matrix of the coefficients in a system
% of equat... |
%MyFisrtScript [script]
clear all; close all; clc;
a = [2 4; 5 6];
b = ones(1, 4);
a = b(:); %Transforma B em Colunna
a = [2 4; 5 6];
b(:) = a; %Mantem o formato de B
clear a b;
n = [9.8 9.9 5.8 6.5 6 5.9 9.9 5.9 ];
%5.9-> 6.0
%9.9-> 10.0
%MATLAB THINKING
n
ind = find(n==5.9 | n==9.9);
n(ind) = round(n(ind));
n |
function result = mInverseJacobiAM( X, M )
%MINVERSEJACOBIAM Inverse of the Jacobi amplitude function AM.
% MINVERSEJACOBIAM(X,M) is the inverse of Jacobi function AM for the
% elements of argument X and parameter M. X and M must all be real and
% the same size or any of them can be scalar.
%
% See also INVE... |
function [path,offsets] = tIdealize( traces, level, options )
% Assigns to one of two states based on threshold level,
% ignoring 1-frame dwells on either side.
% Last dwell is ignored because it includes dark time.
% Copyright 2007-2015 Cornell University All Rights Reserved.
[nTraces,len] = size(traces);
path =... |
function v_d = inv_double_laplace_d(N,T,n,K,r,x,G)
% 6 Compute f->v
% Discrete case
N = N;
T = T;
n = n; %discretization of time
K = K;
r = r;
x = x;
delta = T/n;
P = expm(G*delta); %G->P
m1 = 10;
m2 = 15;
D = diag(x);
v_d = zeros(N,1);
A = 20;
t = K; %a form of strike price
rou = nthroot(exp(-A), ... |
%% =====
load('DataFile1.mat');
load('DataFile2.mat');
load('DataFile3.mat');
load('DataFile4.mat');
load('DataFile5.mat');
NUMBER = 12;
sigma1 = 0;
%% Preprocessing, padding
dt = D1;
[M,N] = size(dt);
DT = zeros(M+2,N+2);
DT(2:M+1,2:N+1)=dt;
X = zeros(M+2,N+2);
X(2:M+1,2:N+1)=dt;
%% Executing and Plotting
figure... |
function multi_abf_to_image()
dir = uigetdir;
% cd ..
[p f] = subdir(dir); %extract subdirectories (p) and filenames (f) therein
figure;
set(gcf,'color','w');
fig_size(gcf,800,491);
for ii=1:length(f)
cd(p{ii}); %make sure to be in right subdir
sf = f{ii};
for jj=1:length(sf)
fullfilename = ... |
function vc=monotonic_cover(v);
% MONOTONIC_COVER computes the monotonic cover of game v
% or from excess game ex_v.
%
% Usage: v=monotonic_cover(v)
%
% Define variables:
% output:
% vc -- Returns the monotonic cover of game v
% or from excess game ex_v.
%
% input:
% v -- A Tu-Game v ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% %%%
%%% PHYSIC CONSTANTS AND APPROXIMATIONS %%%
%%% %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% HEAT CAPACITY APPROXIMATED (Joul)/(KiloGramme*Kel... |
%% Author: Tianli Yu https://netfiles.uiuc.edu/tyu/www/tianli/
%% Date: Monday Aug. 01 2005 11:58 pm
%%
%% SampleTest: This is a sample script to test the TriangulateSpherePoints.m
%%
VertexM = rand(800, 3) - 0.5;
VNormV = (sum(VertexM .^ 2, 2)) .^ .5;
VertexM = VertexM ./ repmat(VNormV, 1, 3);
FacetM ... |
function p_interp = pr_curve_interpolated(p_i, r_i, r_norm, plot_style)
p_interp = []
for r = r_norm
p_interp = [p_interp, pr_interp(p_i, r_i, r)]
endfor
plot(r_norm, p_interp, plot_style, "linewidth", 2)
hold on
endfunction |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.