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

más de 3 años hace | 0

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

más de 3 años hace | 0

| aceptada

Respondida
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])

más de 3 años hace | 0

| aceptada

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

más de 3 años hace | 1

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

más de 3 años hace | 0

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

más de 3 años hace | 1

| aceptada

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

más de 3 años hace | 1

| aceptada

Respondida
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)*...

más de 3 años hace | 1

| aceptada

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

más de 3 años hace | 1

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

más de 3 años hace | 0

Respondida
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); ...

más de 3 años hace | 0

Respondida
I think the ode45 code that I wrote works, but how do I plot it together with both forward and backward euler methods?
I changed your code as to make it work (see above).

más de 3 años hace | 0

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

más de 3 años hace | 0

Respondida
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)

más de 3 años hace | 0

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

más de 3 años hace | 0

| aceptada

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

más de 3 años hace | 0

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

más de 3 años hace | 0

| aceptada

Respondida
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 = (...

más de 3 años hace | 0

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

más de 3 años hace | 0

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

más de 3 años hace | 0

Respondida
I am trying to solve the non-linear solver 'fsolve' to solve the rate equations. But the f(x) shows unprecedented high values and its shows no solution found.
Here is a symbolic solution of your problem. It seems to boil down to determine the roots of a polynomial of order 6. Since you ...

más de 3 años hace | 0

| aceptada

Respondida
Numerically solving a diffusion equation with a piecewise initial condition
I changed V(i,j) = sum((4./(k.*pi).^2).*sin(k.*pi/2).* sin(k.*pi.*x(j)).*exp(-0.5.*t(i).*(k.*pi).^2)); to V(i,j) = sum((4./(...

más de 3 años hace | 1

| aceptada

Respondida
Error in Fmincon, objective function must return scalar
F_S1 = wblpdf(d,mu_Sr1,sig_Sr1) F_S2 = wblpdf(d,mu_Sr2,sig_Sr2) F_S3 = wblpdf(d,mu_Sr3,sig_Sr3) d is a vector with six values...

más de 3 años hace | 0

Respondida
Hi all, can anyone please help to create code for the condition bellow
x = 10:20:200; y = 0.1:0.08:1; [X,Y] = meshgrid(x,y); Z = zeros(size(X)); Z(X<=60) = 8.1.*0.7.*X(X<=60); Z(X>60) = 8.1.*42;...

más de 3 años hace | 0

| aceptada

Respondida
ploting of a serie
N = 53; tstart = 0.0; tend = 0.75; dt = 0.015; t= tstart:dt:tend; t = t.'; n = 0:floor(N/2); c=[0.16192008 0.05711...

más de 3 años hace | 0

Respondida
Normalization of probability distribution function
I think the kernel density is already normalized ... From the documentation: [f,xi] = ksdensity(x) returns a probability densi...

más de 3 años hace | 2

Respondida
How to use lsqnonlin with multiple constraints?
Use lb and ub in the list of inputs to "lsqnonlin".

más de 3 años hace | 1

Respondida
Error using semilogx Vectors must be the same length.
Use A=@ (w) 1./(1 -(Wb./w).^2 - 1i*2*Wb./w); instead of A=@ (w) 1./[1 -(Wb./w).^2 - 1i*2*Wb./w];

más de 3 años hace | 0

Respondida
BVP4C:error Unable to solve the collocation equation -- a singular jacobian encountered
As I said before: Remove x=0 from your interval of integration to avoid a division-by-zero. Nonetheless, bvp4c has problems wit...

más de 3 años hace | 1

| aceptada

Respondida
Error in double integration
syms r ph phi lam=532*10^-9; z=100; k=2*pi/lam; omega=30; w0=0.002;m=1;rho=1;p=1; E = 1./(w0^2) + (1i*k)./(2*z); Con1=(1i...

más de 3 años hace | 0

| aceptada

Cargar más