text
stringlengths
8
6.12M
function [H, rhoScale, thetaScale] = myHoughTransform(Im, threshold, rhoRes, thetaRes) %Your implementation here % Calculate bins for rho and theta, then initiate H [m, n] = size(Im); rhoScale = 0:rhoRes:ceil(sqrt(m^2+n^2)); thetaScale = 0:thetaRes:2*pi; H = zeros(length(rhoScale), length(thetaSc...
function [ idx ] = loc_kmeans( image ) %************************************************************************* % idx = loc_kmeans(image) % % Description: This function returns the RGB+Location KMeans % % Input Arguments: % Name: image % Type: vector % Description: input image % % % Output Arguments: % Name: idx % ...
function import_line_xml_callback(~,~,main_figure) layer=get_current_layer(); layer.add_lines_from_line_xml(); display_lines(main_figure); update_lines_tab(main_figure); end
% ***************************************************************************************** % File Name : plotPoint3D.m % Author : Dingjiang Zhou % Boston University, Boston, 02215 % Email : zdj@bu.edu zhoudingjiang@gmail.com % Create Time : Fri, Aug. 14th, 2015. 09:46:09 PM % Last ...
function [m,RES,TVterm] = nlcg(m0,params) % Phi(m) = ||W(Fu*m - y)||^2 + lamda1*|TV*m|_1 % m: susceptibility % W: weighting matrix derived from magnitude intensities % Fu: F_{-1}*D*F forward calculates the field from susceptibility % y: measured field to be fitted (inversion) % lambda1: TV regularization parameter % TV...
function e = EIRP(P,G) %e = EIRP(P,G) %e EIRP in DB %P transmitted power in dB %G Gain in dBi e = P + G; end
function [ ] = display_image_over_offset( image, offset ) %DISPLAY_IMAGE_OVER_OFFSET Summary of this function goes here % Detailed explanation goes here figure; imshow(uint8(image)); hold on ; quiver([1:size(offset,2)],[1:size(offset,1)],offset(:,:,1),offset(:,:,2)); end
%-------------------------------------------------- %“选择”操作,返回所选择染色体在种群中对应的位置 % cumulatedPro 所有染色体的累计概率 function selectedChromoNums = select(cumulatedPro) selectedChromoNums = zeros(2, 1); % 从种群中选择两个个体,最好不要两次选择同一个个体 for i = 1 : 2 r = rand; % 产生一个随机数 prand = cumulatedPro - r; j = 1; while prand(j) < 0 ...
%% EXAMPLE_FORWARD_KINEMATICS % EXAMPLE_FORWARD_KINEMATICS describes the forward kinematics for 2 or % 3-link arms. For both types, the user can choose to use % rotations and translation dual quaternions, or to use screw % motion dual quaternions. For the two-link arm, only the % ...
function result = improved_Euler(start,finish,stride,u0)%依次是 起点,终点,步长,初始值 %预报矫正的改进的欧拉法 n = (finish - start)/stride;%结点数 u=[];u(1) = u0;%u(1)是实际上的u(0) t = start;%t(0) for i = 1 : n u(i+1) = u(i) + stride/2*( ... t * u(i)^2 ... % f(t,u)= t(i)*u(i)^2 +... ( t + ...
sumOfError=0; figureNumber = 1; for i = 1:2 % Both of the two sets of images for j = 1:3 % For all the three bases figure colormap(gray) subplot(2,2,1) imagesc(bases{j}(:,:,1)) subplot(2,2,2) imagesc(bases{j}(:,:,2)) subplot(2,2,3) imagesc(bases{j}(:,...
function wb = getwb(net,hints) % Copyright 2012 The MathWorks, Inc. wb = zeros(hints.learnWB.wbLen,1); for i=1:hints.numLayers if hints.learnWB.bInclude(i) wb(hints.learnWB.bInd{i}) = gather(net.b{i}); end for j=1:hints.numInputs if hints.learnWB.iwInclude(i,j) wb(hints.learnWB.iwInd{i,j}) = gat...
clear all close all tic load_img_to_database; %create variable out Database = build_Maps_for_Database(out); toc file = str2num(input('Which picture do you select? [1-3]:','s')); switch file case {1} test1 = rgb2gray(imread('draws/river_horse_draw.jpg')); case {2} test1 = rgb2gray(imread('dra...
%@(#) wrnm1.m 1.2 94/08/12 12:11:13 % function wrnm1(farg,symbol) if nargin<1, farg=[0 0 0];end if nargin<2, symbol='o';end wrnmpos=[5 13 9 17 9 25 17 5 17 13 17 25 25 9 25 17]; x=wrnmpos(:,2); y=wrnmpos(:,1); line(x,y,'linestyle',symbol,'erasemode','none','co...
%%% beta plot %%% written by ysl 06/27/2014 %%% updated by mjh 11/22/2017 %%% updated to sphere by mjh 06/14/2018 % Uses same sphere radius as MVPA analysis. close all; clear all; clc; tic %% Paths and parameters [MNI_XYZ,Region] = xlsread([pwd filesep 'multi_roi_list_12subj_v4.xls']); Region = Region((~cellfun(@ise...
% Código para o amplia e reduz base I = imzoneplate; figure; [ha, pos] = tight_subplot(1,3,[.01 .03],[.1 .01],[.01 .01]); % criar subplot 6x2 axes(ha(1)); imshow(I); xlabel('Imagem original'); % Dominio das frequencias psd = 10*log10(abs(fftshift(fft2(I))).^2 ); axes(ha(2)); imshow(psd); xlabel('Dominio das frequenci...
function so = tail(si) % TAIL As streamCdr so = streamCdr(si);
function [A,GL]=Categorical(d) if(iscategorical(d)==0) d1=categorical(d{:,:}); else d1=d; end [m,n]=size(d1); d2=d1(1,:); [G,GN,GL] = grp2idx(d2) for i=1:m d2=d1(i,:); n=grp2idx(d2); num(i,:)=n'; end A=num; end
load('pcadata.mat'); subplot(2,1,1); plot(X(:,1),X(:,2),'bo'); title('Datapoints and their 2 principal components'); xmin=0; xmax=7; ymin=2; ymax=8; axis([xmin xmax ymin ymax]); [Xmu, mu] = subtractMean(X); [U,S] = myPCA(Xmu); hold on; principalComponents = U' + mu; %mean_new = mean(U' +mu); line(principalComponents...
classdef Remote < Modules.Driver %INTERPRETERCLIENT Connects with server.py on host machine to control % the PulseBlaster via the interpreter program. Port 36576. % % Call with the IP of the host computer (singleton based on ip) properties clk = 500 % Hz end properties(SetAcces...
function h = polarhistogramModify( varargin ) %POLARHISTOGRAM Plots a histogram in polar coordinates. % POLARHISTOGRAM(THETA) plots an angluar histogram of THETA. The angles % in the vector THETA must be specified in radians. POLARHISTOGRAM % determines the bin edges using an automatic binning algorithm that ...
classdef CacheCustomSaveLoadPlaceholder < handle properties className token end methods function p = CacheCustomSaveLoadPlaceholder(val, token) p.className = class(val); p.token = token; end function val = doCustomLoadFrom...
r=10; f=0.0001; dis = 0.6; coordinates = [0,(1+dis)*r]; newcoordinates = [0,(1+dis)*r]; Ccoordinates = [0,(1+dis)*r]; Ccoordinatesnew = [0,(1+dis)*r]; c = [0 r/2]; %hold on; %axis([-40,40,0,40]) R = 20; for R=20:30 for dis=0.2:0.2:1 figure; axis([-R-1,R+1,-1,2*R+1]) hold on; %title ...
function [OutMatrix]=ReadTestResults(Column_Total) load MATRIX_MUL_IP_CORE_S_INT_CSV.txt; temp=MATRIX_MUL_IP_CORE_S_INT_CSV; M=size(temp,1); N=size(temp,2); MatrixNumbers=M/Column_Total OutMatrix=zeros(size(temp,1),size(temp,2)); for i=1:MatrixNumbers OutMatrix((i-1)*Column_Total+1:i*Column_Total,:)=Circulat...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % % problem 2 -convolution of x(t) and h(t) t1=0:.1:.9; t2=1:.1:10; h1=zeros(size(t1)); h2=exp(-2*t2); h=[h1 h2]; t1=0:.1:2; t2=2.1:.1:10; x1=ones(size(t1)); x2=zeros(size(t2)); x=[x1 x2...
function ynew=smoothdiff(dados,xnew,sdx,q,nmin) % % function ynew=smoothdiff(dados,xnew,sdx,q,nmin) % % This function smooths and differentiates a sequence of numbers based on % an algorithm similar to Savistky and Golay. There are no restrictions % however, on the number of points or on their spacing. % This fu...
function tsa = tsd(t, qData, tUnits) % % tsa = tsd(t,data) % tsa = tsd(t,data, units) e.g. units = {'ts','sec', or 'ms'; assumes 'sec'} % % tsd is a class of "timestamped arrays" % It includes a list of timestamps % and data (possibly an array). % The first dimension of Data correspond to the % timestamps gi...
function program = setup(conf) if ( nargin < 1 || isempty(conf) ) conf = sfix.config.load(); end conf = sfix.config.reconcile( conf ); program = make_program( conf ); try make_all( program, conf ); catch err delete( program ); rethrow( err ); end end function make_all(program, conf) make_task( program, co...
%% Plot single electrode topography if exist('/home/knight/','dir');root_dir='/home/knight/';app_dir=[root_dir 'PRJ_Error_eeg/Apps/']; else; root_dir='/Volumes/hoycw_clust/'; app_dir='/Users/colinhoy/Code/Apps/';end addpath([app_dir 'fieldtrip/']); ft_defaults elec_lab = 'Fz'; tmp_SBJ = 'EEG01'; tmp_an_id = 'ERP_...
% Solves an 1D one phase flow problem like OpenFOAM clear all; page_screen_output(0); % Case initialization test1 % **************************** MAIN PROGRAM *************************** % Gravity treatment terms ghf = g*xF; gh = g*xC; % Set fields as 'old' states rho0 = rho; U0 = U; p0 = p; % phi field initializa...
% Filename: basschromagram.m % Function: compute the bass chromagram of the input fft amplitude spectrum % Author: tangkk % Date: Aug. 16th 2014 % Organization: The University of Hong Kong function [basschroma, bassmax] = basschromagram(fftAmpSpec, f) % bass chroma % bass range: 20Hz - 450Hz % A = 69, mod (69, 12) = ...
function legendre_total = associated_Legendre(l,x) %% associated_Legendre legendre_total=zeros(2*l+1,length(x)); legendre_total(l+1:end,:)=legendre(l,x); ms=(1:l)'; legendre_total(1:l,:)=flipud(legendre_total(l+2:end,:).*repmat((-1).^ms.*factorial(l-ms)./factorial(l+ms),[1 length(x)])); end
function [y]=fx(x) y=x.^2-6*x+2; return
function [result] = KUR1(x) %KUR1 result = 0; N = length(x); for i = 1:N-1 result = result -10*exp(-0.2*sqrt(x(i)^2 + x(i+1)^2)); end end
clear C_prev = 22; C = 50; % total number of cycles check_cycle = C; test_rep_num = 3; spike_frac = 0; % fraction of H pure culture spiked in spike_test = [0.35 0.7]; sl = length(spike_test); % upper bound for gH_max. for gH_max_Bound = 0.3, set V = 1. gH_max_Bound = 0.8; % the factor for amount of R(0) V = 10; % mini...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %BLP MERGER SIMULATION WITH PAINKILLER DATASET %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Parametric bootstrap merger simulation clear; estimateDemand = true optimalIV = true quadrature = false merge ...
function h=meas(sysflag) % Measureing level in tank system global Xs global Cs Ds en global t Ts Tnext; global Cn2 Dn2 Xn2 n2 global en if sysflag==0, % Physical A/D converter timer=[0 0 0 3600 60 1]'; t=clock*timer; while t<Tnext, t=clock*timer; end; Tnext=Tnext+Ts; [level,stat]=ad_mm1; h=l...
% sQMG24B.m % Solving the Time Dependent Schrodinger Equation using the FDTD Method % Motion of a wave packet % Ian Cooper % DOING PHYSICS WITH MATLAB % https://d-arora.github.io/Doing-Physics-With-Matlab/ % Documentation % https://d-arora.github.io/Doing-Physics-With-Matlab/mpDocs/QMG24A.htm % IAN COOPER ...
global concore; import_concore; load("MPC_data.mat"); xm = Data.op1.x0; % initial condition of plant u = Data.op1.us; % initial input disp("us") disp(u) concore.retrycount = 0; concore.delay=0.01; Nsim=150; init_simtime_u = "[0,0,0,0,0,0,0]"; init_simtime_ym = "[0,0,0]...
function krzywe(xi,yi) % wyznaczanie dlugosci t n=length(xi); tk=[1:n]; % generowanie splainu interpolacujnego 3 stopnia dla danych % S=(tk,xi) oraz Q=(tk,yi) S=splain(tk,xi); Q=splain(tk,yi); % rysowanie wykresu krzywej (S(t),Q(t)) plot(S,Q, 'Color','b','Linewidth',2 ) plot(xi,yi,'or','Linewidth',2, 'MarkerSize',7)...
% 通过差分方程求出系统的频率响应 % 向量化 clear all; x = [0.0181, 0.0543, 0.0543, 0.0181];% 分子 y = [1.00, -1.76, 1.1829, -0.2781];% 分母 m = 0:length(x)-1; l = 0:length(y)-1; N = 1000; k = 0:N;% 等分频率 w = pi*k/N; num = x*exp(-j*m'*w); den = y*exp(-j*l'*w); H = num./den; subplot(2,1,1); plot(w/pi,abs(H),'LineWidth',2); xlabel...
function [x] = check_park(Xc,Yc,ym,xmax,Xm,Ym) %物理参数 Rw =3.5; %单车道宽度 R = 4.5; %设定的转弯半径(略大于Rmin) L = 2.15; %轴距 W = 1.67; %车宽 safe_dis = 0.1; %安全距离 Lc = 3.2; %车长 DR = 0.5; %后悬 %坐标系以车库口中点为原点,车库宽2.5米,深5米 P1x = -1.25; P1y = 0;P2x = 1.25; P2y = 0; P3x= -1.25; P3y = -5; P4x = 1.25; P4y = -5; %车库四角坐标 if Yc < Ym ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %读出要处理的图象 clear clc close all I=imread('lena.tiff'); bw4=rgb2gray(I); %bw4=imnoise(imagray,'salt & pepper',0.05); %bw4=medfilt2(bw4); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %画出原始图象 figure(1) imshow(bw4) title('原始图象') %%%%%%%%%%%%%%%%...
function SS_ResidVariance % PLOT RESIDUAL VARIANCE AS FUNCTION OF K load('run_options.mat'); load('clusters_kmedoids.mat'); load('HCTSA_N.mat'); fprintf('Computing pairwise Euclidian distances for TS using all operations\n'); residVars = []; pcaResidVars = []; S = pdist(TS_DataMat); [pcaM score] = pca(TS_DataMat); ...
function Y = tfidf( X ) % FUNCTION computes TF-IDF weighted word histograms. % Y = tfidf( X ); % INPUT : X - document-term matrix (rows represent documents, columns represent words) % OUTPUT :Y - TF-IDF weighted document-term matrix % get term frequencies tf_X = tf(X); % still matrix D*W % get inverse documen...
function train_mass1_x = noiser(train_x) [len1, len2] = size(train_x); train_mass1_x = zeros(len1,len2); for k1 = 1:len1 pic = train_x(k1,:); % noise = ((pic == 0) .* (rand(size(pic)) < 0.05)) .* (rand(size(pic))*255); train_mass1_x(k1,:) = pic + uint8(noise); % end end
% Herausfinden des Dateinamens für ein abzuspeicherndes Bild. Die % Dateinamen werden im Laufe des PSO-Algorithmus generiert und enthalten % laufende Nummern der Generationen und Individuen % % Eingabe: % Set % Einstellungen des Optimierungsalgorithmus (aus cds_settings_defaults.m) % Structure % Eigenschaften der ...
%% preparation % N=2000; % smalldata = data{1}(:,:,1:N); N=500; smalldata=ffdata; m = mean(smalldata,3); smalldata = reshape(smalldata,[400*750 N ]); smalldata=double(smalldata'); %% skew S=skewness(smalldata); SR=reshape(S,400,750); figure imagesc(SR) title('skewness') %% kurtosis K=kurtosis(smalldata); KR=reshape(...
% % Define these variables appropriately: % mail = mail'; %Your GMail email address % password = pass; %Your GMail password % setpref('Internet','SMTP_Server','smtp.mail.yahoo.com'); % setpref('Internet','E_mail',mail); % setpref('Internet','SMTP_Username',mail); % setpref('Internet','SMTP_Password',password); % props...
%% Gets conditional Frechet mean estimates using local Frechet regression for spherical response data and scalar predictor % Inputs: Y = response data 3xn % x = nx1 vector of predictors corresponding to observations in Y % h = bandwidth % xout = mx1 vector of predictors to be used for computin...
function g = sigmoid(x) g=1.0 ./( 1.0 + exp(-x) ); end
function disableSonar() % sonarInit - This function disables the sonar % ======================================================================== % % sonarInit() % % Description: % This function disables the sonar either in Simulation when % MobileSim is open or in real(Pioneer 3DX). % % Known Bugs: % kn...
rng(0,'twister'); %Sample Data, Randomized % Finger 0 = Thumb ----------------------- % Finger 0(x) mf0x = 77.8; sf0x = 2; f0x = sf0x.*randn(90,1) + mf0x; statsf0x = [mean(f0x) std(f0x) var(f0x)]; % Finger 0(y) mf0y = 80; sf0y = 2; f0y = sf0y.*randn(90,1) + mf0y; statsf0y = [mean(f0y) std(f0y) var(f0y)]; % Finger 0(...
function [F, M] = controller(t, state, des_state, params) %CONTROLLER Controller for the quadrotor % % state: The current state of the robot with the following fields: % state.pos = [x; y; z], state.vel = [x_dot; y_dot; z_dot], % state.rot = [phi; theta; psi], state.omega = [p; q; r] % % des_state: The desired...
function self = rotate(self,v) p=inputParser; addRequired(p,'v',@(x) isnumeric(x) && sum(size(x)==[3,3])==2 || length(x)==4); parse(p,v); if length(v) == 4 q2 = v; else q2 = qrot.q2R(v); end self.q(:)=qrot.quatrot(self.q,q2); return end
function [ res ] = forwardPropagate(X, theta) % uses Sigmoid X = [ones(size(X,1),1) X]; res = sigmoid(X*theta'); end
% This code reproduces the analyses in the paper % Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven % by decision uncertainty and alters serial choice bias. % % Permission is hereby granted, free of charge, to any person obtaining a % copy of this software and associated documentation files (the "Soft...
% This class communicates with digitizers via a TCP/IP % (Ethernet) connection. Digitizer objects are created from a specific % address or a cell array of addresses. % dig=Digitizer('192.168.0.100'); % specific address % dig=Digitizer({'192.168.0.100' '192.168.0.105'}); % address list % The first example returns...
function [y, Sf] = genTraj(IC,FC,tauf,h,ONOFF) %% Interface % IC,FC - terminal conditions % tauf - length of the dimensionless arc % h - graphics handle:: trajectory plot % Generated trajectory %% Initialization and mappingof terminal conditions % IC-"i" d/dt-"dt" d/dtau-"p" % d2r=1; xi=IC(1:3); Vi=I...
%% Demonstration of Profiled Estimation of Differential Equations %% The FitzHugh-Nagumo Equations % % This page provides a detailed description of the MATLAB calculations % necessary to run the profiling estimation code for differential % equations. % % For further technical detail, please refer to the Profile_Users_...
function [markerValue neighbourIxs] = knnClassifier(pt, featurePts, markers, k) % Assigns point with marker (==label) value basing on its neigbours. % Parameters: % pt = [x y z] - point to be classified. % featurePts - potential neighbours % markers - assignment values for featurePts % k - how many neighbours...
%% 自HPGe能谱411keV峰分析Au含量,双峰拟合以处理In-116m的416keV影响 % 先使用handle_nmlHPGe得到标准化能谱 clear;close all; filename = 'data'; load([filename,'-nml.mat']); ch_range = 40; %% 拟合峰面积 peak411 = round(0.411/caliParam.EStep); peak416 = round(0.416/caliParam.EStep); thisRange = (4080:4200)'; thisSpec = spec_meas(thisRange,1); thisROI = [thi...
%-----------Plot config------------------------------- set(0,'DefaultLineLineWidth',2) %---------------------------------------------------- clear all DDs = readtable('vibr_phi.txt'); cell=table2array(DDs); f_cell_splitted = split(cell); f_cell_splitted = str2double(f_cell_splitted); Mag = f_cell_splitted(1:end, 3); ...
function align(bench) %ALIGN Summary of this function goes here % Detailed explanation goes here global naomiGlobalBench; if nargin<1; bench=naomiGlobalBench;end if ~bench.has('wfs') msgbox({'The Wave front is offline', 'Start it first'}); return else if isempty(naomi.findGui('Alignment')) na...
function Anew = householder(A) % householder(A) uses Householder method to form a tridiagonal matrix from A. % Must have a SQUARE SYMMETRIC matrix as the input. % % % Example: % % B=[0 1 1;1 2 1;1 1 1]; % householder(B) % % % Author: Matt Fig % Contact: popkena...
function [samples,LL,exitflag,output,savefilename] = sample_model(data,v_dy,modelid,task,noise,subjid,chainid,dn_flag,rbmflag,Nsamples,startpoint) if nargin < 8 || isempty(dn_flag); dn_flag = 0; end if nargin < 9 || isempty(rbmflag); rbmflag = 0; end if nargin < 10 || isempty(Nsamples); Nsamples = 1e4; end if nargin < ...
function update=update() global u; global nextu; global v; global nextv; q=.002; f=2.5; n=256; Du=1; % Dv=0.000; % Dh=.01;% spatial res Dt=.0015;% time step eps=0.05; for x=1:n for y=1:n %state-transistion function uC=u(x,y); uR=u(modi(x+1,n),y); uL=u(modi(x-1,n),y...
function result = MAV_calc(data, window_size) if window_size > 0 col_count = size(data, 1); result = zeros(size(data)); padded_data = [zeros(col_count, window_size - 1) data]; data_window = zeros(col_count, window_size); for i = window_size : length(padded_data) data_window(:, :) = pa...
function y=op(x,cmd) %applies a vector command to x eval(['y=x' cmd ';']);
classdef highway_HLP < high_level_planner methods function HLP = highway_HLP(varargin) HLP@high_level_planner(varargin{:}) ; end function waypoint = get_waypoint(HLP,agent_info,world_info,d) % d is a 3x1 matrix that holds the front car info. [~, laneidx] = min(d); % [distf, ...
function theme(H, themeID, useMarkers, lineWidth, markerSize, titleFontSize, axesFontSize) %THEME applies a color theme to the specified figure or sets the % default theme of new plots as best it is able. % % Author: Stephen E. Conover % % Version: 1.1 % Date: June 19, 2007 % MATLAB Version: MATLAB Version 7....
function [xdot] = avoidObst(x,xo); e = x-xo epsilon = 1; c = 0.1; K = (1/norm(e))*(c*(1/norm(e)^2 + epsilon)); if norm(e) < 25 xdot = K*e; else xdot = 0; end
function dMdx = MnUBacmb(x,M,p) % p is a structure with the parameters dMdx=zeros(2*p.n,1); dMdx(1)=M(p.n+1); dMdx(p.n+1)=p.K1*M(1)/(p.K2+M(1)); i=1; for j=p.q+1:p.n dMdx(p.n+i) = dMdx(p.n+i)- 2*p.K6*M(j); end for i=2:p.q-1 dMdx(i) = M(p.n+i); for j=i+p.q:p...
close all, clc base = 'Step_'; res = []; go = 1 for i=0.5:0.2:3.9; num = int2str(i); name = strcat(base, num, '.lvm'); fil = load(name); u = fil((end-50):end, 2); res = [res; u']; end
%彩色图像的锐化处理 clc; clear all; close all; addpath(fullfile('G:/stego of me/strict','JPEG_Toolbox')); %f=imread('0.jpg'); %加载原图像 %f=imread('G:/stego of me/strict','tiger1', '1.jpg'); filepaths=dir(fullfile('G:/stego of me/strict', 'tiger1', '*.jpg')); for i=1:600 inputPath=fullfile('G:/stego of me/strict', 'tiger1'...
for n=1:nT for i=2:npts-1 for j=2:npts-1 phi(i,j)=cfl*sqrt((phi(i,j)-phi(i,j-1))^2+(phi(i,j)-phi(i-1,j))^2)*g_DU(i,j)*kurv(i,j)... +(1+cfl*(Dxg_DU(i,j)+Dyg_DU(i,j)))*phi(i,j)-cfl*(Dxg_DU(i,j)*phi(i-1,j)+Dyg_DU(i,j)*phi(i,j-1)); phi2(i,j)=(1+cfl*(Dxg_DU(i,...
% this is a code for modelling of concentric tube robot in free space based on " Design % and Control of Concentric-Tube Robots " by Dupont clearvars clc %% Initializing parameters param % load tube parameters inside param.m file tic l=0.01*[45 30 20]; % length of tubes B=0.01*[-14 -10 -5]; % le...
function dy=vdp1(t,y); dy=[y(2);(1-y(1)^2)*y(2)-y(1)];
load carsmall ds = dataset(MPG,Weight,Model_Year); lme = fitlme(ds,'MPG ~ Weight + (1|Model_Year)') % Plot predicted values conditional on each year. gscatter(ds.Weight,ds.MPG,ds.Model_Year) ds2 = dataset; ds2.Weight = linspace(1500,5000)'; ds2.Model_Year = repmat(70,100,...
function SwapFuelMap(fue_new,ch,mapfil) if ~isstruct(fue_new), resfil=fue_new; fue_new=read_restart_bin(resfil); end fid=fopen(mapfil,'w'); mminj=fue_new.mminj; % Swap the fuel fue_new.ser(ch(2:-1:1),:)=fue_new.ser(ch,:); fprintf(fid,'''FUE.SER'', 6 /\r\n'); blank=' '; % Left Core Half ikan=0; [rig...
function [] = Lorentz_eqs % Solve the Lorentz equations. clc; clear; close all; options = odeset('RelTol',1e-5,'AbsTol',[1e-5 1e-5 1e-5]); sigma = 10; b = 8/3; r=21; [T,Y] = ode45( @ode_Lorentz, [0 15], [5,5,5], options, sigma, b, r ); n = length(Y(:,1)); k = 0; for i=0:n/100:n plot3(Y(1:i,1),Y(1...
function a = MonotoneIncrease_Elegant(vec) % this is the nice way to determine if a vector increases % monotonically. if all(diff(vec)>0)==1 tf = true; else tf = false; end fprintf("Output is %i\n",tf); end
function SBJ06c_TT_ERP_save_mean_window(SBJ_id,proc_id,feat_id,varargin) %% Save amplitude and latency of condition-averaged ERP peaks or mean window in target time (TT) task % COMPUTATIONS: % Select trials for conditions of interest % Load and average single-trial ERP within condition % Find feature based on pea...
frequency_logic = [100 200 300 400 500]; frequency_register = [100 200 300 400 500 600]; power_logic = [0.1415 0.2840 0.5257 0.6992 1.0016]; power_register = [0.2359 0.4773 0.7263 0.9869 1.3718 1.8776]; area_logic = [4181.039986 4176.360006 4807.080038 5236.560042 6531.840052]; area_register = [4782.959931 4913.999997 ...
function Labeling_1(segementAxis) %Labeling_64 Divides images into segemnts for waste class labeling % % segementAxis = Number of segments along x and y axis of the image. % % Show the image to select class between 0 and 1. Class 0 indicates no % waste in the bin and class 1 indicates the presence of waste. If ...
% Example 10.4 subroutine % from Parameter Estimation and Inverse Problems, 3rd edition, 2018 % by R. Aster, B. Borchers, C. Thurber % % ufinal=forward(m,n,deltat,deltax,D,u0) % % Integrate the heat equation forward in time using the Crank-Nicolson % implicit Euler method. % % The system of equations for each step in t...
%************************************************************************** %Function Name: mx_StartPar %Author: Anna Ringheim %Created: 080313 %Description: Returns a struct of model specific start parameters. %Input: %Output: model (struct) %Function calls: %Revision history: %Name Date Comment %AR ...
function [nagent,nn]=agnt_solve(agent) %sequence of functions called to apply agent rules to current agent population. %%%%%%%%%%%% %[nagent,nn]=agnt_solve(agent) %%%%%%%%%%% %agent - list of existing agent structures %nagent - list of updated agent structures %nn - total number of live agents at end of update %Creat...
function a = graphPlot(g, outputFile, varargin) %GRAPHPLOT Plot a graph using SFDP. % A = GRAPHPLOT(G, OUTPUTFILE, OPTIONS) generates a PNG image of the graph G, % saved to OUTPUTFILE. If a return value A is specified, the image is % also loaded into A. The plot is generated by writing G to a temporary % f...
function [D]=patchEdgeLengths(F,V) % function [D]=patchEdgeLengths(F,V) % ----------------------------------------------------------------------- % Computers the edge lengths (D) for the patch data specified by the faces % (F) and vertices (V) arrays. If size(F,2)>2 it is assumed that F indeed % represents faces...
clc clear all %% liquid IspSL = 311; %s IspVAC = 338; %s tb = 253; %s %solid Isp = 330; %s tbS = 94; %s mp = 2889; %kg mdot = 900; %kg/s m0 = 250000; m = m0; g0 = 9.81; y = 0; dt = 1; v = 0 for t = 0:dt:100; y = [y (g0*IspSL*t*(1 - log(m0/m)/(((m0/m)-1))) - (1/2)*g0*t*t )]; g0*IspSL*t*(1 - log(m0/m)/((m0/m-1))); v...
function Y_est = prediction(U_est,V_est,Z,alpha_est,I,J) % predict the observed Y % coded by Eugene Seo (seoe@oregonstate.edu) N_est = U_est*V_est'; P_vec = Z*alpha_est; P_mat = reshape(P_vec,I,J); P_mat = min(P_mat,1); P_mat = max(P_mat,0); if min(P_mat(:)) < 0 || max(P_mat(:)) > 1 disp(num2str(min(...
% Script recording started at : 20-Jun-2018 08:24:35 % YOUR SCRIPT NAME HERE % --------------------- % This is a template for an imlook4d script that runs your code and puts the results into a new imlook4d window. % For documentation: a) imlook4d menu "/HELP/Help", or % b) type in matlab: open...
% % Illustrative how a Baysian Filter works in the context of robot localization % The location of the robot r=[4;4]; figure(1); h=plot(r(1),r(2),'r.'); set(h,'markersize',50,'linewidth',4); axis([0,8,0,8]); % Sensor sense N times. N mesurements, Z vector, have noise follows gaussian % distribution with variance ...
function [Clusters] = unnormalized_spec(Data,k) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here M = size(Data, 1); A = zeros(M); for i=1:M for j=1:M dist = norm(Data(i,:)-Data(j,:)); A(i,j)=exp(-power(dist,2)); end A(i,i)=0; end D = zeros(M); for i=1:M ...
% Calculates the pressure distribution along a porous aerofoil % using the Jacobi polynomial expansion addpath('matlab2tikz/src') imageFolder = '../unsteady-jacobi/images/'; % Set angle of attack and parabolic camber (only use alp=0 for now) beta0 = 1; beta1 = 0; z = @(xVar) beta0/2 + beta1*xVar; struct.z = z; dzdx ...
function V_form %v=vint; %sr=r*Chd; t=t=[0:1e-6:1e-3]; sr=0; v=vint+sr*t; %v=vint+exp(f*t); %v=vint+(1/r+1/rf)*r*t.^2/Chd; %v=vint+tripuls(2*pi*f*t,0.5,0.2); %v=vint+(1/r+1/rf)*r*sin(2*pi*f*t); %v=vint+amp*(1/r+1/rf)*r*square(2*pi*f*t,10); %v=vint-amp*(1/r+1/rf)*r*cos(2*pi*f*t); %v=-(1/r+1/rf)*r*sin(2*pi*f*t)+(1/r+1/r...
function [PSD_n, pSNR] = sp_noiseEstimation_SR(noisy) % ----- initial -------- n = noisy( 1 : 256 ); N1 = fft(n); N = abs(N1(1:129)); Dw = N; D1 = N; minBuffer = N*[1 1 1 1]; FrameNum = 0; frame_num = min(20000, floor(length(noisy)/128)); % ------------------------- Y = zeros(129,1); for ij = 0 :...
n= 4 pai = 3.1415926 xita = linspace(0,4.*pai,1000) fai = xita *0.5 A= 10 t1 = A*sin(n.*fai) t2 = sin(fai) A1 = (t1)./(t2) I1 = A1 .^2 t3 = 4 *(A.^2) t4 = 6*cos(xita).*(A.^2) t5 = 4*cos(2*xita).*(A.^2) t6 = 2*cos(3*xita).*(A.^2) I2 = t3 + t4 + t5 + t6 +500 plot(xita,I1,'--b',xita,I2,'r') legend('1','2')
function EEG2 = denoise_bcg4(EEG) % function EEG2 = denoise_bcg4(EEG) ; EEGfilt = EEG ; EEGfilt.data = eegfiltfft(EEG.data,EEG.srate,5,15) ; corrmat = corr(EEGfilt.data') ; stelec = 46 ; [~,si] = sort(corrmat(stelec,:),'descend') ; meanpost = (mean(EEGfilt.data(si(1:10),:),1)) ; wsize2 = round(EEG.srate*.25...