Answered
How to solve time dependent ODEs of the form (dx/dt = f(x,t))using ODE45
It depends on how the time-dependent term is defined. The following shows an example if the term 'k' depends on time. k_fun = @...

ongeveer 2 maanden ago | 0

Answered
Customize data cursor for 3D objects.
See datatip() function: https://www.mathworks.com/help/matlab/ref/matlab.graphics.datatip.datatip.html. Also, see this example: ...

ongeveer 2 maanden ago | 0

Answered
ode45 third order ode
Use ode45(). this ODE can be written as a system of 3 first-order ODEs odeFun = @(t, y) [y(2); y(3); ...

ongeveer 2 maanden ago | 0

| accepted

Answered
Index Matrix to RGB Matrix
Which colormap do you want to use. For example, try this cmap = summer(16); rgb_imag = ind2rgb(ind_fin, cmap); imshow(rgb_ima...

ongeveer 2 maanden ago | 0

Answered
find the absolute maximum and minimum values of f on the set D
Although you can use fmincon() and specify the nonlinear constraint, this function is multi-modal, and the search region is quit...

ongeveer 2 maanden ago | 0

Answered
Localmaxima in a column of a matrix without the islocalmax
See findpeaks(): https://www.mathworks.com/help/releases/R2020a/signal/ref/findpeaks.html If you have signal processing toolbox....

ongeveer 2 maanden ago | 0

| accepted

Answered
Changing the xticks in a heatmap to a datetime ticks
Try this randMatrix = rand(5,10); t1 = datetime(2020,06,21,8,0,0); t2 = datetime(2020,06,21,17,0,0); Time = t1:hours(1):t2...

ongeveer 2 maanden ago | 0

| accepted

Answered
How to create a combination of matrix values in pairs?
If you have deep learning toolbox A=[1 4;2 5;3 6]; B = combvec(A(:,2).', A(:,1).').'; Result >> B B = 4 1 5...

ongeveer 2 maanden ago | 0

| accepted

Answered
Hello, I am using Fminsearch to find 4 unknowns and i run into the error, "Assignment has more non-singleton rhs dimensions than non-singleton subscripts" and Number of array dimensions must match for binary array op. code and function are below.
fminsearch() requires that the objective function return a scalar value, however, in this case, fx1 return a 10x10x10x10 array. ...

ongeveer 2 maanden ago | 0

Answered
How to retrieve the values and substitute to get all the functions
At this line a = S2.a; b = S2.b; c = S2.c; You are overwriting the variables a, b, and c. Converting them from symbolic to ...

ongeveer 2 maanden ago | 0

| accepted

Answered
How to pop the content of a matrix in a way like pop the content of a cell
Madhan's answer already shows how to use num2cell. Following just show how can you avoid the creation of a temporary variable v...

ongeveer 2 maanden ago | 2

| accepted

Answered
fit data with a line
Try something like this x = linspace(0, 1, 100); y = 3*x + 2 + rand(size(x)); pf = polyfit(x, y, 1); y_pred = polyval(pf, ...

ongeveer 2 maanden ago | 0

Answered
Is MATLAB App Designer in place of Matlab GUI in MATLAB 2020a?
GUIDE is still available in MATLAB R2020a. You can run it using guide However, it is depreciated now and will be removed in fu...

ongeveer 2 maanden ago | 1

| accepted

Answered
Solve for intercepts in nonlinear eq
This equation does not have a closed-form solution. Therefore, you can solve it using fsolve() or vpssolve() if you have symboli...

ongeveer 2 maanden ago | 1

Answered
How to make .bin file
"I tried below code but it seems the binary file is not good". How do you define "good"? Following code shows the image is save...

ongeveer 2 maanden ago | 0

| accepted

Answered
Using a Jocobi Matrix in a State-space model
Convert A to floating-point type before passing to ss() sys = ss(double(A), b, cT, d);

ongeveer 2 maanden ago | 0

| accepted

Answered
how to get the pixel value and the location in an image
See ginput(). For example, run this img = imread('pears.png'); imshow(img) [x, y] = ginput(1); pixel_values = img(floor(x), ...

ongeveer 2 maanden ago | 0

| accepted

Answered
Operands to the || and && operators must be convertible to logical scalar values in integrating product of functions using integral.
It happens if one of the operands is a vector. && only work when variables on both sides are scalar. Try your code after replaci...

ongeveer 2 maanden ago | 1

| accepted

Answered
Automatic Callback creation for UI Button
You can use the ButtonPushedFcn property of the uibutton to assign it a callback. For example btn = uibuttin(); btn.ButtonPush...

ongeveer 2 maanden ago | 0

| accepted

Answered
Grabbing points from scatter plot
This shows how you can randomly select points from the complete dataset x = rand(1000, 1); y = rand(1000, 1); idx = randper...

ongeveer 2 maanden ago | 0

Answered
Matlab Symbolic Maths - How to insert ¨y(t) +˙y(t) +y(t)= f(t) equation in symbolic Maths?
Although there are easier ways to solve this equation in MATLAB (e.g., using dsolve()), you mentioned Laplace transform in your ...

ongeveer 2 maanden ago | 0

| accepted

Answered
Combine fprintf and disp
disp() is not needed here. fprintf('\nSite name: %s \n', name(1:4)) See the documentation of fprintf for detail of the formati...

ongeveer 2 maanden ago | 0

| accepted

Answered
How to read just the powers from matlab output
How are the terms separated? If separated using '+' operator, then try the following code str = '10*z^2*w^4 + 5*w^2*l^2 + 2*z^6...

ongeveer 2 maanden ago | 1

| accepted

Answered
How to make the aspect ratio of the zoom-in window fixed?
You can use daspect() to keep the aspect ratio of the image constant when zooming on a particular region. Also see my answer her...

ongeveer 2 maanden ago | 0

Answered
Display just the first letters of a filename as String
If it is stored in a variable as a char array, then you can simply use indexing x = 'TestFile_18.06.2020.txt'; disp(x(1:4))

ongeveer 2 maanden ago | 1

| accepted

Answered
vector3d random sample
vector3d is not a MATLAB class. In case you have data points in the form of n*3 matrix. You can do something like this M = rand...

ongeveer 2 maanden ago | 0

Answered
How to change 'figure' title to wanted text
fig = figure('Name', 'St Kilda Wave Height', 'NumberTitle', 'off');

ongeveer 2 maanden ago | 0

Answered
Stop execution of function using a specific key press
See WindowKeyPressFcn callback(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/matlab.ui.figure-properties.html#bui...

ongeveer 2 maanden ago | 0

| accepted

Answered
Solve the differential equation
Use ode45(). Try following code xspan = [0 1]; ic = 1; % initial condition [t, y_sol] = ode45(@odeFun, xspan, ic); plot(t,...

ongeveer 2 maanden ago | 0

Answered
Solve the differential equation
See ode45(): https://www.mathworks.com/help/matlab/ref/ode45.html#bu3uj8b. For example xspan = [0 5]; ic = [1; 0]; % initial c...

ongeveer 2 maanden ago | 0

Load more