MATLAB Programming

386

Solutions

455

Contributors

MATLAB is a numerical computing environment and proprietary fourth-generation programming language. MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, Fortran and Python. Although MATLAB is intended primarily for numerical computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic computing capabilities. An additional package, Simulink, adds graphical multi-domain simulation and model-based design for dynamic and embedded systems.

Share tech news, updates, or what's on your mind.

Sign up to Post

I am using the ODE15s function in MATLAB and am getting an error.

 I am getting the following error (attached) when running the second part of the code.  Matlab is saying the varible T is not being used.  I'm a newbie to matlab and I can't figure out why it's complaining about T.

Natalie_bsCODE.png
Code for the function I used:
%Dua's function practice
function xdot = dua_glucose(t,x,u)

%t is time, x is the arrays, u is the insulin infusion rate

% (1) Input
% Exogenous Insulin infusion rate (mU/min)
% % u = 3;

% (2) States 
% Plasma Glucose Conc. (mg/dL)
G = x(1,1);
% Plasma Insulin Conc. (mU/L)
I = x(2,1);
% Plasma Insulin Conc. (1/min) in remote compartment
X = x(3,1);

%x is a matrix or (combination of arrays G,X,I). Consisting of a 3(variables) by n
%matrix which n is the time step size. 

% (3) Parameters From the original ex
%Assuming these conditions until literature
%is investigated further, For future will need
%Normal person values, and differing diabetic?
% Basal values of glucose and insulin conc. *Normal values
G_basal = 4.5; % mmol/L
%%X_basal = 15; % mU/L *Note there is not xb
I_basal = 15; % mU/L
% For a type-I diabetic These are parameters
P1 = 0.028735; % min-1
P2 = 0.028344; % min-1
P3 = 5.035e-5; % mU/L
%insulin distribution volume
V1 = 12; % L
%the fractional disappearance rate of insulin
n = 5/54; % 1/min
%rate of exogenously infused glucose
Fg = 0.5/t; %mg/min (divide by t?)
%glucose distribution space
Vg = 5; %dL 
% (4) 

Open in new window

0
CompTIA Network+
LVL 13
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Hello,

I am a beginner, so please excuse the confusion.

In MATLAB, I have used importdata to read a mixed type .csv in, creating a 1x1 structure with two fields (data (96x2) and textdata (97x7)). data should go in the last two columns of textdata under the header row. I eventually want to create a cell array (num2cell) of the concatenated matrix of data/textdata so I can index specific values and run descriptive statistics on them but vertcat/ horzcat aren't working because the field dims are different.

I've tried textscan also, but it creates a 1x4 cell array with each cell being 96x1 (such that I can't see any of the data).

Here is my code:

% This code runs descriptive statistics and creates graphical
% represntations of m-sit data to see how participants responded to negative/
% neutral pictures that were presented after fMRI scan session

%function [meanoutput, sdoutput, maxoutput, minoutput, rangeoutput]...
 %   = postrate_function(responseNumber, responseTime)

% Bring folder to current directory
cd 'C:\Users\krublab\Desktop\Raisa\MSIT_post_rate_raisa\msitPostRate_data'
dirpath = 'C:\Users\krublab\Desktop\Raisa\MSIT_post_rate_raisa\msitPostRate_data';
% Add folder to search path
addpath(dirpath)

% Create flexible file names structure to read from
filePattern = fullfile(dirpath, '*-post.csv');
fileNames = dir(filePattern);

% Pad for loop to begin iterating at 01 instead of 1
pad = sprintf('%02d', 1);
for pad = 01:length(fileNames)
0
Hi to all,

I use findpeaks function in my code to calculate the four maximum values of a fft function.

I use it in this way:

[maxpeaks, idx] = findpeaks(10*log10(psdx),'MinPeakDistance',195,'NPeaks',4,'MinPeakHeight', -Inf, 'SortStr','descend')

Open in new window


The problem is that I need to run the code in a Matlab version which doesn't have the Signal Processing Toolbox. Is there any solution to write a similar function without the need of the SP Toolbox?

Thank you!
0
Please help i want the image to be in canny edge n perform fuzzy logic with this code

img1=imread('F:\Matlab Project\7 sem\currency\10.jpg')




Igray = 0.2989*img4(:,:,1)+0.5870*img4(:,:,2)+0.1140*img4(:,:,3);
%Igray1=edge(Igray,'Canny');
%figure
%image(Igray,'CDataMapping','scaled');
%colormap('gray')
%title('Input Image in Grayscale')

%Convert Image to Double-Precision Data
I = double(Igray);


%Scaling the factor
classType = class(Igray);
scalingFactor = double(intmax(classType));
I = I/scalingFactor;

%Obtain the Image Gradient

Gx = [-1 1];
Gy = Gx';
Ix = conv2(I,Gx,'same');
Iy = conv2(I,Gy,'same');

%figure
%image(Ix,'CDataMapping','scaled')
%colormap('gray')
%title('Ix')

%figure
%image(Iy,'CDataMapping','scaled')
%colormap('gray')
%title('Iy')

%Define the Fuzzy Inferences System
edgeFIS = newfis('edgeDetection');

%Specify the image gradients, Ix and Iy, as the inputs of edgeFIS
edgeFIS = addvar(edgeFIS,'input','Ix',[-1 1]);
edgeFIS = addvar(edgeFIS,'input','Iy',[-1 1]);

%
sx = 0.1;
sy = 0.1;
edgeFIS = addmf(edgeFIS,'input',1,'zero','gaussmf',[sx 0]);
edgeFIS = addmf(edgeFIS,'input',2,'zero','gaussmf',[sy 0]);
%
edgeFIS = addvar(edgeFIS,'output','Iout',[0 1]);

%Specify the triangular membership functions, white and black, for Iout.
wa = 0.1;
wb = 1;
wc = 1;
ba = 0;
bb = 0;
bc = 0.7;
edgeFIS = addmf(edgeFIS,'output',1,'white','trimf',[wa wb wc]);
edgeFIS = addmf(edgeFIS,'output',1,'black','trimf',[ba …
0
Calculating Beta values using for weibull analysis using matlab or excel.

I tried to follow a string from 2012 but i was unable.

I understand how to plot this graph on paper to find the 63rd percentile but it is the beta part that i am having trouble with..

any help would be much appreciated!
0
I am trying to use Matlab 2016 as a neural network. I have large amounts of comma-delimited ASCII data that I would like to analyze. Each row of data contains about 1500 elements of alphanumerics. There would be about 100 records/rows of 1500 elements each. The first task I need to do is determine the correlation, if any, between the various elements. I think that would be a clustering issue. Is it practical, or advised, to try to run the entire block of data at one time, or to pick out what I think are the relevant factors and just analyze those for correlations? I have reasonably powerful computing equipment and I don't know if time factors would make looking at the entire data set prohibitive. Once I determined which way to do that, and have figured out some of the correlations, I would then have to set up an actual neural network to try to get some insight into larger blocks of that same type of data.

Any help will be appreciated and points awarded. Thanks.
0
HI

I have angles of head movements for each video frame in radians ,where positive values yaw correspond to head turning right and

negative values corresponds to head turning to the left .

 I need to calculate movement dynamics ( angular displacement , angular velocity ,angular acceleration )
yaw.csv
untitled.jpg
0
(i) Develop an algorithm to determine whether a graph represented by a node-node incidence matrix is connected or not. Provide a clear algorithm statement.
(ii) Code your algorithm in any programming language you prefer, run your code on the node-node adjacency matrices. The matrix is 300x300. Also, I need to report my results along with the computation time in seconds
0
How to write program for  encryption and decryption input text using RC4 algorithm in Matlab?
0
I have attached the file of Matlab output. How to detect the intersection points red dots. Whenever it detect the red dot at intersection alert message should be displayed.
curveintersectionsexample.png
0
Learn SQL Server Core 2016
LVL 13
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Hi, I am beginner in Matlab, need help or advise on how to do this? If i have 2 image in gallery (one basketball image and one badminton image)-Basketball.JPG/Badminton.JPG I created GUI. Then i am able to upload the one of the image. But how do i compare this upload image with the 2images in gallery. So that if uploaded image matches Basketball, it will display Basketball. and if uploaded image matches Badminton,it will display Badminton.
0
I am using MATLAB 2009,I have a micro-structure image and I transformed into greyscale image and then to BW.  Now I want to know the number of pixels along the scale bar (scale bar width is one pixel size), in order to calculate grain size. Please help me to find out How many pixels in the line of specified length with constant width of pixel size. using MATLAB. or suggest me other way to find the grain size from the microstructure image.
Thank you in Advance.
0
I want to find out principal curvatures for a image in MATLAB.  How to find it out and how will be its code in MATLAB
0

MATLAB Programming

386

Solutions

455

Contributors

MATLAB is a numerical computing environment and proprietary fourth-generation programming language. MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, Fortran and Python. Although MATLAB is intended primarily for numerical computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic computing capabilities. An additional package, Simulink, adds graphical multi-domain simulation and model-based design for dynamic and embedded systems.

Top Experts In
MATLAB Programming
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!