MATLAB Programming

384

Solutions

456

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

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
Microsoft Azure 2017
LVL 12
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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
You can refer to section 4.3.1 in this article if you want.

Problem: Given a reference point and a direction, I need to find the core of a line scratch.


  1. To do that, according to the article, I need to select a prominent point on the line-scratch and that point would be used as the reference point pR.
  2. Then start a search from that reference point, proceeding on both sides of the line along the direction dS.
  3. If pI is our current point at column k (shown in yellow here),
    • take 5 points adjacent to pI at column k+1 (shown in blue here).
    • find the point with the largest similarity value.
    • add the point to the core.

pixel-candidatesWe will use a specific function as the similarity measure. That function uses correlation, among other things, as a measure.

equation
  1. pI is the i-th pixel at the column-k.
  2. w1 and w2 are constants with values 0.75 and 0.25 respectively.
  3. cG is a global correlation factor measured between a matrix centered at pR and another matrix pKi which has a center at pI.
  4. g is a Gaussian function computed at pI.
  5. cL is a local correlation factor measured between a matrix centered at pK_1s and another matrix pKi which has a center at pI.
  6. pK_1s is the last included point at the core.

Implementation
Please, see the source code later in this question.

What is the problem I am facing right now?
 
  1.  I am not sure whether the matrices (i.e. pKi, matrix around pR, pI and so on) I am using are taken correctly.
  2.  I am not sure about the usage of dS.
0
I am very new to image processing and Matlab. I am working with RGB image and used SLIC algorithm to generate superpixel for an image. By using regionprops to calculate the superpixel properties.

[Rcounts binlocations]=imhist(ImageRED);
[Gcounts binlocations]=imhist(ImageGREEN);
[Bcounts binlocations]=imhist(ImageBLUE);
Q1: I have 48 superpixels with Counts(R,G,B channels) it is giving me 256*1 double(most of them are zero). Can anybody explain how to refine them to get each superpixel histogram?

Q2: How can I compare and calculate the distance between two specific superpixel histograms?

Any help is greatly appreciated. Thanks in advance
0
how can I add a constraint for vibration damper in a SUV vehicle model meant to demonstrate a rollover
0
Become a Microsoft Certified Solutions Expert
LVL 12
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

How to write program for  encryption and decryption input text using RC4 algorithm in Matlab?
0
how i can apply fuzzy logic for this problem? Or is there any other technique i can use for my problem?

Input : parameter values Output : (1) OLTP , (2) DSS , (3) % of OLTP and % of DSS

I have to classify between 3 classes as OLTP, DSS and mix type. if my input matches with OLTP or DSS type it return crisp class. if it matches with mix type it returns the percentage of OLTP and DSS
0
How can i apply fuzzy logic for this problem? Or is there any other technique i can use for my problem?

Input : parameter values Output : (1) OLTP , (2) DSS , (3) % of OLTP and % of DSS

I have to classify between 3 classes as OLTP, DSS and mix type. if my input matches with OLTP or DSS type it return crisp class. if it matches with mix type it returns the percentage of OLTP and DSS.
0
Two vehicles update their position using latitude and longitude using .csv file. Plot the graph for two vehicles in a single graph to detect the collision.
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
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
Hi

in the following code I'm searching for a match of indexes between 2 files , if I found a match take -6,6 elements from the 1st file .

I need to save the found data as (1,13) . (data ) array shows the elements as I print it when I run the code  but after finishing executing only the last element is saved .

earFilename = 'EAR_v1.txt';
stateFilename = 'output_close_tags_video_1.txt';

% read EAR values
 earfile = fopen(earFilename,'r');
 formatSpec = '%d %f %f';
 sizeA = [3 Inf];

earVector = fscanf(earfile, formatSpec, sizeA);
earVector = earVector';

% read state file
 statefile = fopen(stateFilename,'r');
 formatSpec = '%d %*s';
 sizeA = [1 Inf];

   stateVector = fscanf(statefile, formatSpec,sizeA);
   stateVector = stateVector';

% create a dataset containing framenumber, EAR, state
dataset = [earVector, -1*ones(size(earVector,1),1)];

% for each positive state, +-6 frame are marked as positive
data=[];
for i = stateVector'
  rowNumber = find(dataset==i);
  for j = -6:6
      data=(rowNumber+j);
      disp(data)

Open in new window

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

384

Solutions

456

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!