Answered
How to calculate Area under a curve
Try this to get the integral only between 20 and 40: lims = (x >= 20) & (x <= 40); Integral = trapz(x(lims),y(lims));

7 years ago | 0

| accepted

Answered
Plotting in Matlab with Range for Independent Variable
You need to use element-wise operations in the division: A = sqrt((sqrt(k/m)).^2+16)./(sqrt(k/m)); ...

7 years ago | 0

| accepted

Answered
FIND DIFFERENT ELEMENTS BETWEEN TWO GROUPS
See if the setdiff function will do what you want. Also explore other Set Operations if setdiff does not do what you want.

7 years ago | 1

| accepted

Answered
I'm trying to find the integral of dv and all variables have been defined. I get the error message 'Dot indexing is not supported for variables of this type.' or if I remove the dot I get 'Not enough input arguments.' Please show me my error. thanks
The erroir is that ‘dv’ must be defined as a function of one variable, and it is not defined as a function at all. What varia...

7 years ago | 0

| accepted

Answered
Using a logic mask for selective data operations
The ‘logicmaskneg’ and ‘logicmaskpos’ matrices become numeric matrices when used in any calculation. See if this does whatt y...

7 years ago | 0

| accepted

Answered
Solving a System of 2nd Order Nonlinear ODEs
It is usually easier to let the Symbolic Math Toolbox do the ‘heavy lifting’: syms g k L m th(t) t u(t) Y th1 = diff(th); ...

7 years ago | 0

| accepted

Answered
Generating transfer function is extremely slow
I do not completely understand what you are doing. Consider whether using the tunableTF function (R2016a and later releases) ...

7 years ago | 0

Answered
How to calculate mean and standard deviation
Mean: mean Standard Deviation: std

7 years ago | 1

| accepted

Answered
How to "save" to workspace image received by few operations?
See if the savefig function will do what you want. It saves the complete figure and the vectors or matrices that were used to c...

7 years ago | 0

Answered
Need help flipping axis values
I am not certain what the problem may be. Using your previous code: %Constants: h = 6.626e-34; k = 1.381e-23; c = 2.998...

7 years ago | 0

Answered
Temperature-dependent thermal properties
I am not certain what you want. (I cannot run your code, since I do not know what the arguments to the function should be.) ...

7 years ago | 0

Answered
Can I select the number of points in which ode45 is evaluated?
See the documentation section on ‘tspan’. Use the multiple-element ‘tspan’ argument, with the elements correspoinding to the no...

7 years ago | 1

| accepted

Answered
Standard deviation between two vector
I suspect that what you want are confidence intervals for the fitted regression line, since ‘standard deviation’ does not make s...

7 years ago | 0

| accepted

Answered
Undefined function 'tf' for input arguments of type 'char'.
You need to have the Control System Toolbox licensed and installed. This: ver('control') will tell you if you have it. If...

7 years ago | 1

Answered
How to save data from Genetic Algorithm in case MATLAB crashes?
It took a bit of trial and error, however this appears to work: function [state,options,changed] = SaveOut(options,state,f...

7 years ago | 2

| accepted

Answered
Fit 2 parameters with fminsearch and use ODE15s to solve single differential equation
Using that model of the Gompertz equation, your code is correct. If you want to avoid negative rate constants, use lsqcurvefi...

7 years ago | 1

| accepted

Answered
how to create a matrix from another one, using for loop
I do not get an error when I run it. A simpler approach (that avoids the nested loops and the if block): Ai = mat == 'A'; ...

7 years ago | 0

Answered
shade area between two line that changes color when two line cross
Try this: x=[1,2,3,4,5,6,7,8,9,11,12,13,14,15,17,18,19]; y=[2,3,4,1,1,0,0,9,15,16,20,-3,-5,-6,10,11,12]; y1=[-2,-3,-4,-1,-1,...

7 years ago | 0

| accepted

Answered
Is it possible that ploting bode diagram without transfer fuction?
Yes. Use the fft function. input = randn(1, 10000); output = randn(1, 10000); time = linspace(0, 1000, 10000); Fs = 100...

7 years ago | 2

| accepted

Answered
Projectile motion plot angle not working on graph
Your code works when I run it with: Vo = 100; Theta = 45; y0 = 0;

7 years ago | 0

Answered
Add uncertainty interval time-series
Depending on the plot resolution, it could be difficult to see easily. Try this: time = linspace(0, 20); temp = 20+10*sin(...

7 years ago | 0

| accepted

Answered
Create New Arrange of a Matrix - Rearrange Matrix
I created values for your data, since I do not have the original values. Try this: Col1 = repmat((1:4), 5, 1); Col1 = Col1...

7 years ago | 1

| accepted

Answered
how to plot Contour Plot?
I assume your variables are vectors. If they are gridded, it is only necessary to use the reshape function to form them into ma...

7 years ago | 0

| accepted

Answered
ode45 two equations
The ODE functions are defined with the derivative on the left-hand-side of the equal sign, and the expression on the right, so f...

7 years ago | 1

| accepted

Answered
Matlab confuses variable with matrix
Apparently, ‘x’ is a vector (or array). Use element-wise exponentiation (.^) in that event: f=@(x) 54*(x.^6) + 45*(x.^5) - 10...

7 years ago | 0

Answered
How to interpolate mooring data and creat a Longitude-depth profile.
I am not certain what you want as a result. Try this: temp35W = [ 12 0 28.25 28.09 27.41 25.57 21.77 17.94 15.83 14.49 13.2...

7 years ago | 1

| accepted

Answered
Why do i get "Too many output arguments" when i try to multiply my function?
You did not create an output when you declared your function. Try this slightly modified version of your function: function...

7 years ago | 0

| accepted

Answered
I need to plot solid/black, solid/red, dashed/black and dashed/red for x1 x2 x3 and x4. How can I plot dash?
Try this: plot(t,x1Sol(t),'black', 'linewidth' ,2) hold on plot(t,x2Sol(t), 'red','linewidth' ,2) plot(t,x3Sol(t), '--b...

7 years ago | 0

| accepted

Answered
Adding Color Under Certain Areas of Function Plot
Try this: % %% Part 1: Solar Radiation %Constants: h = 6.626e-34; k = 1.381e-23; c = 2.998e8; t = 5800; r_sun = 1.39e9/...

7 years ago | 0

| accepted

Answered
function with ln and log
It is missing a multiplication operator: y2 = (x-1)(log((3^.5)/2)*x-log(3/8)); ↑ Try this: y2 = (x-1).*(log((3^.5...

7 years ago | 0

Load more