MATLAB Programming

371

Solutions

441

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 using MATLAB  to solve equation using (syms) then evaluating the result. The program is working. However, each loop taking almost 23 second. Is there anyway that I can optimize program so it will work faster?

I used the below code
clear;
clc;
syms A B C D E ; 
R=((4*B*A)/((D-C)^2+(B+A)^2));
R1=((4*B*A)/((D+C)^2+(B+A)^2));
F1 = ellipticK(R);
I1 = ellipticE(R);
F2 = ellipticK(R1);
I2 = ellipticE(R1);
P= ((((A*B)^(1/2))/(2*E*(R^(1/2))))*(((2 - R)*F1) -...
    (2*I1)))-(((((A*B)^(1/2))/(2*E*(R1^(1/2)))))* ...
    (((2 - R1)*F2) - (2*I2)));
P1=feval(symengine,'simplify',P,'IgnoreAnalyticConstraints');

X=(1/B)*(diff(P1,D));
X1=feval(symengine,'simplify',X,'IgnoreAnalyticConstraints');
[B,D]= meshgrid(linspace(0.1,10),linspace(0.1,10));
E=3;
N1 = 10*rand(100000,1);
N2 = 5*rand(100000,1);
M(:)=0;
for i=1:100000
    tic
    A=N1(i);C=N2(i);
    F = matlabFunction(X1);
    B = F(A, B, C, D, E);
    In(:,:,i)=B(:,:); 
    fprintf('%d\n ', i); 
    toc
end

Open in new window

0
Free Tool: Path Explorer
LVL 8
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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
Hi,

I have a covariance matrix and I am using Matlab's chol function for cholesky decomposition. However, since my matrix is not a positive definite matrix. I am getting an error. How can I figure out which correlations/covariances in the matrix are leading to the problem.

Attached file contains the matrix.

Thanks
EE1.xlsx
0
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
Free Tool: Subnet Calculator
LVL 8
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Hi

I have .csv file with two cols . I need to take 13 values from 1st col then 13 values from 2nd cols and make then as one row with 26 col

until the end of file .
zju_25_5.csv
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

371

Solutions

441

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!