Answered
Problem Calculating Mean of Function
It's obvious that mean(x/y) does not equal mean(x)/mean(y) for arrays x and y. Test it for a simple example.

3 years ago | 0

| accepted

Answered
Evaluating a function using kramers-kronig relation
syms omega omega0 Omega Gamma real kappa(omega) = 1/(2*pi) * Gamma^2/((omega-omega0)^2 + Gamma^2) ; nR(omega) = 1 + 2/pi*int(O...

3 years ago | 0

Answered
Solving BVP PDE in 3D
Would like to confirm if these are all my options or if there are others. Using MATLAB, these seem to be the only options. And ...

3 years ago | 0

| accepted

Answered
Solving ODEs with variable updates at a set of discrete time points.
However, this is computationally expensive, and I'm looking for a way to incorporate these variable updates into a single simula...

3 years ago | 0

| accepted

Answered
I am trying to solve those two coupled differential equations analyticaly or numericaly but I only received errors. I will appreciate any help
An analytical solution of your equations seems hopeless because of the exp(...) term. Use a numerical approach. ico=10; ...

3 years ago | 0

| accepted

Answered
Error in line 53 when using linear interpolation
The name of the interpolation function is "interp1", not "interpl".

3 years ago | 1

Answered
Array indices must be positive integers or logical values.
You define a variable "length" as length = (3.76*(P/abreast) + 33.2); % Fuselage length in ft This conflicts with the MATLAB f...

3 years ago | 1

| accepted

Answered
,v1Trying to solve a linear equation matrix with a log of X1-X5 in the matrix. Not sure how to use the log value in simulate to get correct result.
A = [1 0 0 0 0 0.05 0 0 0 0 0;-1 1 0 0 0 0 0.05 0 0 0 0;0 -1 1 0 0 0 0 0.05 0 0 0;0 0 -1 1 0 0 0 0 0.05 0 0;0 0 0 -1 1 0 0 0 0 0...

3 years ago | 0

Answered
how can i loop a cvs file so that it weeds positive results out of the negative results and separates them into different age groups
This pulls out positive results from a positive / negative result chart: X = X(X>0) This assigns the positive results to each ...

3 years ago | 0

| accepted

Answered
Error: Index in position 2 exceeds array bounds. Index must not exceed 1.
You defined a variable called "zeros": zeros = [1; -1]; This conficts with the MATLAB function to define an array of zeros: y...

3 years ago | 0

| accepted

Answered
Pdepe- Spacial Discretization has failed. Trying to solve a heat transfer equation and I'm confused on how to definte the boundary conditions for my case
At the moment, your boundary conditions read k*dT/dx = -40 at x = 0 k*dT/dx = -T at x = L I don't think this is what you try...

3 years ago | 0

Answered
simulation takes hours to run. ''variable appears to change size on every loop iteration( within a script). how do I preallocate for speed please?
Preallocate it with the largest possible size. But if the simulation takes hours, I doubt the missing preallocation is the bottl...

3 years ago | 0

| accepted

Answered
How do I place a point anywhere along x axis (with range 100m) in a plot?
x0 = 53; y0 = 0; plot(x0,y0,'o') ylim([0 1]) xlim([0 100])

3 years ago | 0

| accepted

Answered
can someone help with this error please
Instead of tspan = [0,2] use tspan = linspace(0,2,100) This fixes the number of output times to 100 for both calls to ode45...

3 years ago | 1

Answered
Hi, can someone help me with this. It gives table function error "Index exceeds the number of array elements. Index must not exceed 1.” I’m finding it hard to locate error.
My guess is that one of the arrays you address in your code (AR_1_CV;AI_CV;ARTC_CV;FC_CV;ACT_BEV;ACR_CV;ACS_CV;OC_CV;Depre_CV;AT...

3 years ago | 0

Answered
Plotting from For Loop ODEFUN and BVP4C Initial Guess
global m Pr etainf = 20; % Find Convergence for both Temp and Velocity %% Thetadot(0) vs Pr m = 0; PR = 0:0.5:50; f...

3 years ago | 1

| accepted

Answered
Cantor function in matlab
N = 20; f{1} = @(x) x; for i = 1:N-1 f{i+1} = @(x)(0.5*f{i}(3*x).*(x<=1/3) + 0.5.*(x>1/3 & x<2/3) + (0.5+0.5*f{i}(3*x-2))...

3 years ago | 1

| accepted

Answered
How to solve these 3 equations with 3 variables which are in radian.
syms t1 t2 t3 eqn1 = 140 + 140*cos(t1)*sin(t2)*sin(t3)-140*cos(t1)*cos(t2)*cos(t3)-180*cos(t1)*sin(t2)==0; eqn2 = 140*sin(t1)*...

3 years ago | 1

| accepted

Answered
How to interpolate from a dataset using interp3?
It's completely unlogical, but the documentation of interp3 says: If X, Y, and Z are grid vectors, then size(V) = [length(Y) le...

3 years ago | 1

Answered
How do I pass inputs into external functions from ode45?
This code works without syntax errors, but you should pass all your parameters to "func" and distribute them from there among th...

3 years ago | 0

Answered
Create for loop to calculate irr
syms r n N symsum(1/(1+r)^n,n,1,N) ko = 100; tot_profit = 7; n = 30; fun = @(r) -ko + tot_profit* ((r+1)^n-1)/(r*(r+1)^n); ...

3 years ago | 0

Answered
How can I define initial condition in a for loop?
syms x y(x) Dy = diff(y); sol = dsolve(diff(y,x,2)+y==0,y(0)==9,Dy(0)==9) v_0 = [9;9]; T = 10; dt = 0.0001; N = T/dt; v ...

3 years ago | 0

Answered
I want to integrate a symbolic matrix numerically. How can I do it??
syms x y A = [1 x^2+y^2;x-y x^2+y^2]; IntA = int(int(A,x,0,10),y,0,15)

3 years ago | 0

Answered
How to extend x range of pwelch
Multiply the result from pwelch by 10. :-)

3 years ago | 0

| accepted

Answered
Creating Distribution by Specifying Densities
If the masses add to 1, your x-coordinates together with the probability masses already define the distribution. There is no rea...

3 years ago | 0

Answered
Trying to solve Line 5: Parse error at x0: usage might be invalid MATLAB syntax.
Works (see above). Functions have to be placed after the script part of your code.

3 years ago | 0

| accepted

Answered
Please how can I writ this function in Matlab
if (D-A*B)^2<=(1+B)*C^2*(A+D) E_min = (2*C^2+(-1+B)*(-A+D)+2*abs(C)*sqrt(C^2+(-1+B)*(-A+D)))/(-1+B)^2; else E_min = (...

3 years ago | 0

Answered
using lsqnonlin with multiple functions
So you want sum(((x(1)*(lambda.^(x(4)-1) -lambda.^(-.5*x(4)-1))+x(2)*(lambda.^(x(5)-1) -lambda.^(-.5*x(5)-1))+x(3)*(lambda.^(x...

3 years ago | 0

Answered
I need a band pentadiagonal algorithm solver. To solve the system of linear equation Ax=b, where A is a band pentadiagonal matrix.
Define A using "spdiags" and use backslash to solve. I doubt a self-written solver for banded matrices will be faster and/or mo...

3 years ago | 0

Load more