How to calculate the derivate of an equation ?
To calculate a numerical derivative of a vector, use the gradient function. If ‘N’ is a vector, use gradient on it, then mult...

9日 前 | 0

| 採用済み

take values from old matrix to newer
Create the output matrix ‘B’ as: B = A(all(A(:,3:5) >= 0, 2),:) % Result Example— A = [randi(9...

9日 前 | 0

| 採用済み

Matlab gives no result when I use the ODE (Ordinary Differential Equations)
The differential equation is nonlinear (the ‘y^2’ term) and very few nonlinear differential equations have analytic solutions. ...

9日 前 | 0

| 採用済み

How to filter data that detects peaks or irregularities?
Several functions already exist to do that, among which are findpeaks, islocalmax, ischange, and others.

10日 前 | 0

Get an image as an input from webcam
I assume here that you are using a USB webcam, and not the Image Aquisition Toolbox. To take picture, use the snapshot functi...

10日 前 | 0

How to get a 3D image from 2D countourf?
Black surf plots are common with very densely-gridded data. To avoid that, set 'EdgeColor' to 'none': D = load('Pedobarograp...

10日 前 | 0

| 採用済み

Reverse calculate a table of values
I am not certain what a ‘3D table’ is. Perhaps you intend a three column table or array. If that is true, then the interp1 f...

10日 前 | 1

| 採用済み

Sequence a_n =1/n
Use element-wise division: n = 1:100; format short Seq = 1./n producing: Seq = 1.0000 0.5000 0.3333 0.2500 ...

10日 前 | 1

| 採用済み

Calculate area under curve of multiple peaks
Using cumtrapz: [peaks,loc]=findpeaks(crestbar, 'MinPeakProminence', 30); [trofs,troflocs] = findpeaks(-crestbar, 'MinPeakPro...

10日 前 | 0

We need to install Global Optimization Tool
Try running these lines from a script or your Command Window first: restoredefaultpath rehash toolboxcache That may fix th...

11日 前 | 0

convert plot3 to contour plot
Use the griddata function: a = randi(9, 10, 3); x = a(:,1); y = a(:,2); z = a(:,3); xv = linspace(min(x), max(x), 6); ...

11日 前 | 0

Index exceeds matrix dimensions error "for my code"
It is unfortunate that we do not get the opportunity to see what ‘X’ is for the various files, nor anything else about them. ...

11日 前 | 0

| 採用済み

this is a part of my test and i cant find the mistake in this .
The obvious observation is that ‘x’ is going to be less than 10 from the initial iteration through how many iterations it takes ...

11日 前 | 0

| 採用済み

Error in saveas, Invalid figure handle
I cannot run your code because I do not have the necessary files. However: %% Let's plot T and RH times...

11日 前 | 0

| 採用済み

Custom colour bar, excluding the Blue from RGB.
Define ‘CustomColourMap’ as: CustomColourMap = @(x) [linspace(0,1,x).' linspace(1,0,x).' zeros(x,1)]; then to use it: Cust...

11日 前 | 0

| 採用済み

how to make fuction from changing varibles
That is relatively straightforward to do with ndgrid or meshgrid. Try this hypothetical example: Z = @(x,y,z) x.^2 + y.^2 +...

11日 前 | 0

Add 0.5 *0.5 degree grid on figure (country)
This illustrates the general approach: x = linspace(44, 64); y = linspace(25, 40); t = linspace(0,2*pi); circx = 0.25*(ma...

11日 前 | 0

| 採用済み

How can i plot with if statement ?
Try this: x=[10 20 30 40 50 ] ; for k = 1:numel(x) if x(k)==10 y(k)=((10*10^6)*.1523)./ x(k) ; end if...

11日 前 | 0

Make a Plot using loop
Subscript ‘Cp’ and the plot magically appears! Dg=150; %mg Vd=50; %L Ke=0.4; %h^-1 Ka=1.6; %h^-1 t=0:0.1:10; for k = 1...

11日 前 | 0

| 採用済み

titel for tables with spce between the words
The R2019b release allows spaces and other (inluuding Unicode) characters in table variable names. Upgrade to it and you will b...

11日 前 | 1

| 採用済み

How to change the size of error bar?
I am not certain what you want. Try this: errs = rand(1,10); x = 1:10; y = randi([10 20],1,10); figure plot(x, y) ho...

12日 前 | 1

| 採用済み

Ending a recursive function
I have not run your posted code, however two things are immediately apoparent. First, in the calls to ‘mysequence’, the fun...

12日 前 | 0

Relational operator == doesn't work properly in some cases!
You are seeing the effects of floating-point approximation error. See for example: Why is 0.3 - 0.2 - 0.1 (or similar) not e...

12日 前 | 0

| 採用済み

C.T. signals convolution in Matlab
One approach: syms h(t) x(t) s t Fcn1 = h(t) == exp(-2*t)*4 - 4*exp(-t); Fcn2 = x(t) == heaviside(t); convlap = laplace(Fc...

12日 前 | 0

| 採用済み

how can i Solve this equation With ode45
Try this: syms y(t) w T Y DE = diff(y,2) + w; [VF,Subs] = odeToVectorField(DE) ODEfcn = matlabFunction(VF, 'Vars',{T,Y,w})...

12日 前 | 0

Problem using function fsolve
Use a different initial parameter estimate vector. Try this: z0 = rand(3,1); Your code divides the parameters by each othe...

12日 前 | 0

| 採用済み

Creating a 3d plot of the solutions to an ODE as the time a switch condition activates varies
I am not certain what you want to do. Try this: function L2_ode45 tspan = linspace(0, 500, 50); t1 = 100:100:500;...

12日 前 | 1

| 採用済み

Replacing NaN with last real value
If you have R2016b or later releases, use the fillmissing function. I am not certain what you want to do, so see the method a...

12日 前 | 0

| 採用済み

Peak value on plot graph
If you have R2017b or later, you can use the islocalmax function. If you have the Signal Processing Toolbox, you can use the ...

12日 前 | 0

| 採用済み

Finding the percentage of NaN cells in columns
This does everything for all the tables in ‘C’: D = load('C.mat'); C = D.C; for k = 1:numel(C) C{k}(:,1:4) = fillmissin...

12日 前 | 1

| 採用済み