Quantcast
Channel: MATLAB programming & numeric computing platform
Viewing all 31064 articles
Browse latest View live

Hooke-Jeeves Direct Penalty Technique

$
0
0

Hello, I'm new in matlab. Can someone help me on how to conduct Hooke-Jeeves direct penalty technique in Matlab? I'm trying to solve optimisation problem of data fitting between experiment and simulation result.

submitted by /u/thoufeili
[link] [comments]

Using Matlab for thermodynamic systems

$
0
0

I'm trying to write Matlab code to solve my thermodynamics problems, I have come across MatlabMarina thermodynamics but unfortunately couldn't get that GUI or any of the functions to work so I'm trying to do it from scratch. Please if anyone has a clue on this topic if there is a way to setup a bank of solvers like a compressor solver and a pump or whatever solver and then be able to put these pieces together to form a closed loop system to workout all the states of the fluid going through the system. Also wondering if I can make it plot PV, TS or PH graphs . Or if someone can just help me install matlab Marina functions correctly and possible give a run down on how to use it usefully in a system because the only tutorial I've seen is how to set water to be a saturated liquid.

Tldr Is it possible to make a thermodynamics question solver?

submitted by /u/HardNoodleMaster
[link] [comments]

how to convert picture to RGB matrix ?

$
0
0

i want to convert a pricture to RGB matrix with 5 column that show each pixel to [ i , j , R,G ,B] but i dont know how can i do it ?

submitted by /u/NHP2710
[link] [comments]

Read what operations were used to convert matrix to reduced echelon? (rref)

$
0
0

Hello! I am looking for a way to tell what operations were used when I use the command to convert a matrix to echelon form. The ultimate reason is I want to determine the determinant by multiplying the diagonals as it will be an upper triangular matrix. So I need to know if a row was interchanged for example, or if scaling was used so that I can change the now reduced determinant to the original determinant. I am aware that you can just use a determinant function but I am not looking to do it that way. Thanks!

submitted by /u/minniebenne
[link] [comments]

Matlab DAA

$
0
0

Hello. I don't have experience with matlab and I need to convert a matching algorithm, it's a deferred acceptance algorithm, from 1 to 1, to many to 1.

I want to pay someone to do it.

You guys can help me with it, or tell me where i can find someone who can do it?

submitted by /u/tryitout91
[link] [comments]

A general question for matlab professionals

$
0
0

Hi guys!

My name is Marco and I’m a dating coach. I help busy professionals in their dating lives.

I am always trying to get to know my audience a little more, that’s why I ask you the following:

As experts in design and simulation, what are the challenges you are facing in your dating lives ?

Thanks!

submitted by /u/Marco_Villani
[link] [comments]

Inputting values to a bilinear function

Help with Streamslice

$
0
0

Hello everyone, first time posting in this subreddit, but I have been banging my head against the wall trying to solve this issue I am having. When I use the streamslice function to plot my electric field lines for a tiny parallel plate capacitor I get lines that either doesn't start on a plate or end on a plate which looks bad if this is to be a published plot. You can see what I mean in the attached image. any suggestions on how to fix it?

I don't want to use quiver (unless I can make it look like streamslice with connecting lines) and streamlines function does not work too well.

https://preview.redd.it/ffidhzjki3851.jpg?width=560&format=pjpg&auto=webp&s=842f19f2e0c240a1ccab6da8045dfb07c88a7f5f

submitted by /u/sneakyguy7500
[link] [comments]

How to rotate ROI box on Image Labeller app.

$
0
0

Hey there guys,

I'm currently trying to generate the groundtruth data for training a faster Rcnn object detector on matlab. I'm using the image labeller app to create an ROI label around the license plate of my images as that is what I am trying to detect. So what I'm asking is if it is possible to rotate the rectangle of ROI label definition at Image Labeler, in order to define the exact object and not superfluous information around of it. Rotating every single image (I have to process over 4,000 images) at different angles and redefine the object is time-consuming.

submitted by /u/HandyRevolver
[link] [comments]

Anonymous Maclaurin expansion

$
0
0

Hey I am trying to create an anonymous matlab function for the maclaurin expansion of log(x+1). I've tried a few different ways, so far I'm at a for loop

apx=@(x,n) 0;

for i=1:n

apx = apx + ((-1)^(n+1)).*((x.^n)/n);

end

My main issue is getting the all of the terms to sum at the end to get an accurate approximation, can someone tell me what I'm doing wrong?

submitted by /u/ryderalston
[link] [comments]

Iteratively Fitting Data from two ODEs

$
0
0

Hello everyone,

I am currently trying to create a program that automates the manual guessing process. I am currently trying to find the constants (mu_max, Ks, and Ycs). The paper I am studying gives me bacterial growth data (that I plotted in red dash lines) and the paper confirms that the bacteria follow the two differential equations shown below.

https://preview.redd.it/3iqinedqy5851.png?width=645&format=png&auto=webp&s=d7d0919b92de8d77bceccc22ccb2549512f4a6e8

I have 3 functions set up that allow me to input guesses for my growth constants (mu_max, Ks, and Ycs) and someone from this forum was nice enough to create a way to estimating the error of the constants vs. the raw data. The constants are used with ode45 to create two lines (solid red and blue) and I am using those to show how well my constants work to fit the raw data.

https://preview.redd.it/q4eqfbjoz5851.png?width=688&format=png&auto=webp&s=fa067cc8f7d4502d8828ef552a8c0c54587b090b

However it is really tedious to manually insert these values and guess. The guesses are inserted into the vector called "params0" and a vector "params" outputs better guess. nErr is also displayed to show the norm between the calculated data points and the raw data.

Does anyone know an efficient way of having matlab loop guesses into parmas0, fix the guesses based on the output of params until the guess has an nErr of 1? I could brute force it with rand but I'm sure there is a more efficient way. Here is the code I have so far. Thank you to everyone who has helped me on this forum. I wish I was back on campus to ask my prof, so sorry to keep bothering!

% This is the program I run function growthSim() % Get testing data: dVals at time values tVals tVals = [0 10 18 25 33 37 40 44 50]; dVals = [0.5 1 1.5 2.9 5.5 11.4 16.3 19.2 20.9; 50 48.5 45.2 38.8 24 11.8 4.5 0.3 0]'; plot(tVals,dVals,'--r','LineWidth',2) hold on % Given test data, optimize ode parameters to minimize the error % between the data and the ode simulation % Initial Guesses...how do I automate this??? params0 = [0.0974,3.76,0.4036]; [params,nErr] = fminunc(@(p)costFun(p,tVals,dVals),params0) C0 = [0.5 50]; muMax = params0(1); Ks = params0(2); Ycs = params0(3); [~, sVals] = ode45(@(t,x)SYS(t,x,muMax,Ks,Ycs),tVals,C0,0.01); plot(tVals,sVals) end % These two programs are saved in the same folder function nErr = costFun(params,tVals,dVals) C0 = [0.5 50]; muMax = params(1); Ks = params(2); Ycs = params(3); [~, sVals] = ode45(@(t,x)SYS(t,x,muMax,Ks,Ycs),tVals,C0,0.01); nErr = norm(sVals-dVals); end % Initializing the differential functions function dC = SYS(~,y,muMax,Ks,Ycs) % Defining our independent and dependent variables % t = time % y(1) = Cell Cocentration, X % y(2) = Substrate Concentration, S % muMax = 0.0974; % h^-1 % Ks = 3.76; % g/L % Ycs = 0.4036; % Defining the functions of change over time. dC = [ (muMax*y(2)*y(1))/(Ks+y(2)) -(muMax*y(2)*y(1))/((Ks+y(2))*Ycs) ]; end 

Please let me know if you need anymore information!

submitted by /u/EricVelezJustiniano
[link] [comments]

A suitable course

$
0
0

Hello everyone I just want you to suggest me courses to learn matlab. I am a sophomore electrical engineering student and I have a little background about C language and python. I’ve taken the tutorial in the website and it was quite helpful but it does not give me The deep with in the fluency that I need.

submitted by /u/0ssamaak0
[link] [comments]

Why am I getting this error? Help!

How do I vectorize a y=A(k)*x calculation?

$
0
0

Definition of variables:

y := [3xn]

A := [3x3] // depending on variable k stored in a [nx1] vector

x := [3xn]

I am aware of bsxfun, but that is only working with two variables, right?

But also then I‘d need to define a function f(k,x1,x2,x3) and call something like

y = bsxfun(f,k,x(1,:),x(2,:),x(3,:));

Which feels overly complex for a standard equation like this.

Currently I am solving it with a for-loop but it feels like I just haven’t found the right function.

Sorry for the poor formatting, I am on mobile currently.

submitted by /u/Aurelius_boi
[link] [comments]

Optimizing codegen-generates executable runtime using LAPACK and BLAS

$
0
0

I have successfully converted my MATLAB code to an executable on my local Windows PC. However, without using libraries such as LAPACK and BLAS, the executable is extremely slow due to the large amount of linear algebra computations involved. I was shocked to find out that codegen doesn’t just automatically use these libraries— I have to write some backend myself!

Let’s look at LAPACK. I found this link telling me I need to write this class for codegen. https://www.mathworks.com/help/coder/ug/generate-code-that-calls-lapack-functions.html However, the problem is that modifying this template requires some knowledge of how these backend things work, which is way out of my comfort zone as a math student. I found the libmwlapack.lib and lapacke.h files in matlabroot/extern on my Windows PC that can be used as the LAPACK library/header to link to, but since the executable is meant for a Linux cluster (Slurm), how should I modify the template so that the path is correct for that? The ‘pwd’ in the template is definitely not gonna work.

This also seems like a very clunky way to do something conceptually really simple. And I would much prefer to generate this executable on my local machine. I know that for ‘mex’ you can just use the flag ‘-lmwlapack’ and ‘lmwblas’ and voila. But ‘mex’ won’t give me an executable. Is there a simple way similar to that but produces an executable? Thank you so much for your help!

submitted by /u/Wiererstrass
[link] [comments]

Surveying the MATLAB community

$
0
0

Hi! I'm currently preparing for my master thesis in which I will be conducting surveys for research concerning MATLAB and many of its features. Therefore, one of the target populations for my surveys will be the MATLAB community, so I was wondering if:

  • anyone knows about any similar work done (here on Reddit or elsewhere) that I could study;
  • you think this would be a good place to start gathering respondents.

Any feedback would be very very helpful. Thanks in advance!

submitted by /u/er_reis
[link] [comments]

HOW CAN I DISPLAY THE ROUNDED NUMBER TO TWO DECIMAL PLACES IN MATLAB? Please help me, thank you

$
0
0

I want to solve variable M3 with respect to variable A ( and it seems like I did it!) and I want to display to the screen like this: "M3 = 3.49A" not the whole fraction thing! I tried to use fprintf ('M3= %.2f * A ', M3) and there was error :(( Can anyone help me please, i am really close to finish this homework. I really appreciate your help and Thank you in advance!

Here is my code: https://pastebin.com/MU1vTpeW

https://preview.redd.it/u677eauq29851.png?width=1790&format=png&auto=webp&s=316ad5d6752ccd1461e1306381354d5622d68f34

submitted by /u/toilaKhoa
[link] [comments]

How can i add uncertain real parameter to dynamic system?

Advice on debugging FasterRCNN object detector?

$
0
0

Hey guys, I trained a fasterRCNN object detector for the purpose of detecting license plates; on 36 images as a quick test run. Then when I tested the detector it didn't even show a bounding box around the license plate on any of the 10 images I tested on it.

This is the code I have used so far:

trainingData = gTruth

imDir = fullfile ('C:\Users\charl\OneDrive\Desktop\Andis Stuff\GithubProject\Testing\LP Images');

rng(0);

shuffledIdx = randperm(height(trainingData));

trainingData = trainingData(shuffledIdx,:);

options = trainingOptions('sgdm', ...

'MiniBatchSize', 1, ...

'InitialLearnRate', 1e-6, ...

'MaxEpochs', 5);

detector = trainFasterRCNNObjectDetector(trainingData, layers, options)

img = imread('lptest2.JPG');

Run detector.

[bbox, score, label] = detect(detector, img);

Display detection results.

detectedImg = insertShape(img, 'Rectangle', bbox);

figure

imshow(detectedImg)

Where would you say I went wrong:

training dataset too small?

mini epoch size too small?

(I set it to 1 as I had images of different sizes and was worried if the resolution was to small it wouldn't be able to detect the license plate at all)

training options configured poorly?

Ground truth data configured poorly?

Or mabe the ROI labels on the image labeller app need to be more tight?

Any suggestions to fix this detector would be immensley appreciated.

submitted by /u/HandyRevolver
[link] [comments]

Filtering (deleting numbers smaller tha certain threshold) for tables.

$
0
0

I have a table 2000x1 that I need to delete alla the numbers that are bellow 10) with an array I can simply write B=a(a>10) but when i try to do this with a table I can't.

submitted by /u/Whitecat90
[link] [comments]
Viewing all 31064 articles
Browse latest View live