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 = @...

15 jours 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: ...

15 jours 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); ...

15 jours 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...

15 jours 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...

15 jours 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....

16 jours 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...

16 jours 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...

17 jours ago | 0

| accepted

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 ...

17 jours 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...

18 jours 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, ...

18 jours 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...

18 jours 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...

18 jours 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...

18 jours 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);

18 jours 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), ...

18 jours 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...

18 jours 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...

18 jours 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...

18 jours 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 ...

18 jours 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...

18 jours 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...

18 jours 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...

19 jours 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))

19 jours 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...

19 jours ago | 0

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

19 jours 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...

19 jours 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,...

19 jours 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...

19 jours ago | 0

Load more