Answered
Normal random number generation
pd = makedist('Normal'); t = truncate(pd,0,1); r = random(t,1e6,1); figure(1) histogram(r,100) Or directly: r = -sqrt(2)*e...

4 years ago | 1

Answered
cumsum function question for integration
cumsum(y_cos*inter_val); is a Riemann sum for the integral of sin(t) - integrated between 0 and x. But the integral of sin(t) ...

4 years ago | 1

| accepted

Answered
I want to do exponential fitting for power decaying with time
x=[ 65.10 1.0000e+000 65.90 61.0843e-003 70.30 21.3693e-003 ]; fun = @(p)exp(-p*(x(:,1)-65.1)); f...

4 years ago | 0

Answered
How to define an ellipse by the eigendecomposition of its transformation matrix?
phi = linspace(0,2*pi,100); S = [1 0;0 4]; xy = S*[cos(phi);sin(phi)]; theta = pi/4; Sxy = [cos(theta) -sin(theta);sin(theta...

4 years ago | 2

| accepted

Answered
I have some coupled nonlinear ordinary differential equations. Three equations have three 2nd order derivative coupled together. Can someone tell me how I can get the response
Solve the third equation for theta_dotdot and insert this expression in equations (1) and (2). Then use the usual substitution...

4 years ago | 1

| accepted

Answered
When calling a user defined function, MATLAB throws an error for simple matrix multiplication
"const1" and "const2" are not visible in "planck_function" since you didn't declare them as "global" in the calling program. Bu...

4 years ago | 0

Answered
How can i use optimproblem as a free derivatives method?
https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8736798

4 years ago | 0

Answered
how to use symsum for this problem
If you use symbolic variables, you should name them as such. And you shouldn't name a variable "sym", especially if you do symb...

4 years ago | 0

Answered
How to code Flux Boundary Conditions for a PDE using ODE15s and method of lines
One of many possibilities: dc/dr = 0 c2 - c1 = 0 -> dc1/dt = dc2/dt De*dc/dr = kf*(C-c) De*(cn-c(n-1))/Vl_stage = kf*(C-...

4 years ago | 0

| accepted

Answered
Error: Not enough input arguments
r = [2.5 1.2 0.45]; y0 = [1 1 0 1 0 0]; tspan = linspace(0,5); soltrue = ode45(@(t,y)diffun(t,y,r),tspan,y0); yvalstrue = de...

4 years ago | 1

| accepted

Answered
how to use derivative of function using gradient?
Add the variable "dens_mix" as an algebraic equation to your system (e.g. as y(13)): dydz(13) = y(13) - (partial_dens(1)+partia...

4 years ago | 1

Answered
Why fsurf show anything for my function?
Is this an explanation ? clear syms eta__2 zeta__2 Hvs2 =((2305843009213693952*(eta__2 - 8331386150863307/9007199254740992)^...

4 years ago | 0

Answered
Curve Fitting Toolbox for Surface Extrapolation
[fitresult, gof] = fit( [xData, yData], zData, ft, opts ); xq = (xData(1)+xData(2))/2; yq = (yData(1)+yData(2))/2; zq = feval...

4 years ago | 0

| accepted

Answered
dsolve unable to find symbolic solution to sets of ODE
The equations are much too difficult and the size of your ODE system is much too large to be solved symbolically. Use a numeric...

4 years ago | 0

| accepted

Answered
Vectorization: incompatible sizes of arrays
n_p = 3; n_o = 3; P = rand(n_p,2); R = randi(n_p,n_p*n_o,1) IP = (cell2mat(arrayfun(@(i)vertcat(repmat(i,1,n_o)),1:n_p,'Unif...

4 years ago | 0

| accepted

Answered
how to remove error in the code?
And where is the fiunction "star4" ? Your call should be [t,C] = ode45(@star4, t, C0); % Solve the system according to the tim...

4 years ago | 0

Answered
How can I segment a matrix based on the difference between a column's elements of the matrix?
X=[ 8.3700 -53.3090 11.4000 -116.6670 13.0000 -117.8350 26.7000 -105.8580 36.4000 -121.5060 39.40...

4 years ago | 0

| accepted

Answered
Plot the Planck's Radiation curves Below
x-axis and y-axis for the two plots have very different scales. So there must be an error in your formulae if we compare it to t...

4 years ago | 0

Answered
Why is MatLab outputting 0s instead of the value?
E2 = (-1./(1+sec(x)))' instead of E2 = (-1/(1+sec(x)))'

4 years ago | 0

| accepted

Answered
Any comment to speed up the sum calculation of a function which includes legendre polynomials?
M = 1000; x = linspace(-1,1,M).'; y = x.'; for i = 1:11 Lpix(:,i) = legendreP(i,x); Lpjy(i,:) = legendreP(i,y); en...

4 years ago | 0

| accepted

Answered
matrix simultaneous equations returning 0s
Ax = 0; Ay = 0.25; Bx = 0; By = 3.25; Py = 30 + 3.5118*7; x=0.5:0.5:4; nx=length(x); y=-1:0.5:5; ny=length(y); xM=zeros(2...

4 years ago | 0

| accepted

Answered
how to store every value that i get from each iteration of for loop ?
k=1 f=2 t=rand(100); an = sin(2*pi*(2*k-1)*f*t)/(2*k-1);

4 years ago | 0

| accepted

Answered
How to find second intersection point?
x1 = 0:0.0001:1.5; f1 = 1./x1; f2 = sqrt(5./2 - (x1.^2)); Intersections = find(abs(f1-f2)<0.00005); xvalues=x1(Intersections...

4 years ago | 0

Answered
Heat transient equation not executing
The terms in your series do not agree with the formula you posted. You must decide which one is correct and which one is wrong...

4 years ago | 0

Answered
How to keep a specific value in binary matrix with column constraint?
@Maria Your last question was quite interesting - so I invested some time ... If A becomes larger, you will have to work with ...

4 years ago | 0

Answered
How to solve a large symbolic system of equations with boundary conditions
Don't solve symbolically, but numerically if you plan to work with so many equations. clearvars; clc %--- Cantidad de elemento...

4 years ago | 1

| accepted

Answered
Why are the output variables, that I expect to be real, complex?
%Constant parameters% a = 0.005; %sheet half thickness% eps0 = 8.9*10^-12; %vacuum dielectric constant% eps_2 = 80; %water ...

4 years ago | 0

| accepted

Answered
Euler method table problem.Why my fprintf(y(i+1)) only has the last ans, my y1-y(i+1) is incorrect and how to let the table be tidy?
h=0.002; x=0:h:1; y=zeros(size(x)); y(1)=0; n=numel(y); y1=exp(x)-x-1; for i=1:n-1 f = x(i)+y(i); y(i+1) = y(i) ...

4 years ago | 1

Answered
Parameter adjust for complex functions
fminsearch also works with functions, not only function handles. fun = @(f)FUN(f(1),f(2),f(3),f(4)); f10 = ...; f20 = ...; f...

4 years ago | 0

| accepted

Load more