Answered
My Newton Raphson Script Stucks at first step
a = 1.0; e = 1e-6; N = 30; syms x fsym = cos(x)-x*exp(x); f = matlabFunction(fsym); g = matlabFunction(diff(fsym,x)); s...

4 years ago | 1

Answered
I need to find the length of the longest strictly increasing subsequence array from a given array I just need a tip to start. Any type of help will be appreciated
Here is another code that does what the OP wants (not my own work :-)) Maybe interesting for speed comparisons. a = [0,1,2,3,4...

4 years ago | 1

Answered
How to get a random 50x14 matrix from 300x14 matrix
A = rand(300,14); p = randperm(300,50); B = A(p,:)

4 years ago | 1

Answered
How to calculate velocity from X and Y positions and time?
@Daniela Pereira for the purpose of calculating STD at the given timepoints for several of these datasets? STD of what ?

4 years ago | 0

| accepted

Answered
solve x*tan(x)-0.5=0
x1=0:0.1:1.3; y1=x1.*tan(x1)-0.5; x2=2:0.1:4.1; y2=x2.*tan(x2)-0.5; x3=5.5:0.1:6.9; y3=x3.*tan(x3)-0.5; plot(x1,y1,x2,y2,x...

4 years ago | 1

| accepted

Answered
fmincon solver not working
fmincon is a numerical solver. Inputs to the functions and outputs from the functions must be numerical values, not symbolic e...

4 years ago | 0

| accepted

Answered
I have a system of ODE equations. In the function file when I had to define Zero Array, I get an error for matrix array. How can I fix it?
dy = zeros(3*n+2,1) But then you also have to specify 3*n+2 initial values for the variables you solve for. You only specify n...

4 years ago | 0

Answered
solve tan(x)+2*x=0
Your check must be check(n)=tan(v(n))+2*v(n) instead of check(n)=tan(180*v(n)/pi)+2*v(n)

4 years ago | 1

Answered
fsolve no solution found system of two equations
A=8.88e-21; B=5.84e-20; C=5.4e-22; D=1.53e-18; A=A*(1e18)^1.16 B=B*(1e19)^1.109 C=C*(1e18)^1.011 D=D*(1e19)^0.838 x1=lin...

4 years ago | 0

| accepted

Answered
pdepe help! The solution gives 0...
IC = @(x) findIC(x,Cin); ... function C0=findIC(x,Cin) if x==0 C0 = Cin; else C0 = 0.0; end end ...

4 years ago | 0

| accepted

Answered
Plotting an inequality of two related variable in a linear space
Try f = @(a,b)a^3/b^2-(- 8*a^6+3*(a^3)(b^2)+sqrt(2*(a^5)(b)+7*(a^2)(b^4))); fimplicit(f,[0 1 0 1]) I didn't use it until now...

4 years ago | 0

| accepted

Answered
How to find intersection of two curves
T = 250:0.01:500; qg = 1.09.*10^16.*exp(-7550./T)./(1+1.34.* 10^9.*exp(-7550./T)); qr = 5.9.* 10^4.*T-1.82.* 10^7; idx = ((qg...

4 years ago | 0

Answered
2D Laplace Heat Transfer on Cylinder Help
% Define Constants alpha=besselzero(0,160,1); % Pull first 5 roots of J0 R=0.31; % Radius of cylinder, in H=0.240; % Height,...

4 years ago | 0

| accepted

Answered
For loop vector issue
E = 0:0.01:w; n = numel(E); for i = 1:n e = E(i); ... Sbvec(i) = Sb; end

4 years ago | 1

| accepted

Answered
How do I graph a vector with one variable
t = 0:0.1:10; y = t.^3/3 - t + 4; z = 9/2*t.^2 + 9; figure(1) plot3(y,z,t) %or figure(2) quiver(t,zeros(1,numel(t)),y,z,0...

4 years ago | 0

Answered
Evaluating Symbolic, Definite Integral with Bessel's Function
You might want to compare with the numerical solution: An = integral(@(r)20*besselj(0,A.*r).*r,0,3.1,'ArrayValued',true)

4 years ago | 0

| accepted

Answered
solving coupled system of odes
Try this (you can run it as is): % this is the main function in another file : function main %tspan = [0 500]; %y0 = [-2;1;5...

4 years ago | 0

Answered
Euler method for 2nd and 1st order differential equation. Im not sure what im doing wrong
MATLAB's array indices start at 1. So x(0)=0.2;y(0)=1 %initial conditions will throw an error. Further I don't know why you ...

4 years ago | 0

Answered
solving PDE with boundary conditions involving derivative
Cf = ...; bcfcn = @(zl,Cl,zr,Cr,t)setBC(zl,Cl,zr,Cr,t,Cf); sol = pdepe(m,eqn,@findIC,bcfcn,z,t); function [pl,ql,pr,qr]=set...

4 years ago | 0

| accepted

Answered
Condensing code cannnot figure out easier function to use
number_of_elements = 9268; blocklength = 300; maximum = 30; rest = mod(number_of_elements,blocklength) number_of_elements...

4 years ago | 0

Answered
How to depicted the R function versus alfa in my code?
ALFA = 0:0.01:10; bet = 2; lan = 1; teta = 2; mu = 0.5; n = 4; k = 2; R = zeros(size(ALFA)) for...

4 years ago | 0

Answered
How do I make a range for a graph that is from 0 to 2pi in increments of pi/4?
Theta = 0:pi/4:2*pi or Theta = linspace(0,2*pi,2*pi/(pi/4)+1);

4 years ago | 0

| accepted

Answered
How to get 3D histogram with marginal histograms
https://stats.stackexchange.com/questions/24568/normalizing-a-2d-histogram-and-getting-the-marginals

4 years ago | 0

Answered
How to solve 2nd order DE with Explicit Euler method?
g = 9.81; L = 1.0; T = 1.0; dt = 0.01; y_0 = pi/2; v_0 = 0; f = @(t,y)[y(2),-g/L*sin(y(1))]; t = (0:dt:T).'; nt = nu...

4 years ago | 0

| accepted

Answered
MATLAB PDE BC'S
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t) Nu = 1.0; % left Bc = ul pl = 0; ql = 1; % right BC= ur pr = Nu*ur; qr =...

4 years ago | 0

Answered
Multiple fminbnd errors with a parametrized function
You are in the realm of numerical, not symbolic computations. Here, functions are defined as handles: fun = @(t) exp(cos(t)) -...

4 years ago | 1

| accepted

Answered
Finite difference method to solve a nonlinear eqn?
g = 9.81; L = 1.0; T = 1.0; dT = 0.01; y_0 = pi/2; v_0 = 0; f = @(t,y)[y(2);-g/L*sin(y(1))]; tspan = 0:dT:T; y0 = [y_0...

4 years ago | 0

| accepted

Answered
Integral of a matrix (x = integration(v)dt) to find x in each time step - how to get it?
After replacing the NaN values in the matrix, just do T = [5 5.005 5.015 5.020 5.025]; A = [0.223886255942431 0.76659480876201...

4 years ago | 0

| accepted

Answered
Generate Random Numbers to satisfy a variable on the left and right hand side
Here is a code with which you get M2 versus M1 curves for the vector P01 of pressures for which the relation Ctheta_exitvolute...

4 years ago | 0

Answered
too many input arguments when using pdepe
sol = pdepe(m,@(x,t,u,dudx) wave_ode1(x,t,u,dudx,p),@pdeic2,@pdebc2,x,t); function [c,f,s] = wave_ode1(x,t,u,dudx,p) % Equati...

4 years ago | 0

| accepted

Load more