Answered
Finite Difference Centre Time Centre Space
Never ever use centered-in-space for the advection equation ! I commented out the settings for the centered-in-space scheme (nu...

4 years ago | 0

Answered
find radius of xyz data
It's an optimization problem: min: r^2 s.c. (x_i-x_s)^2 + (y_i-y_s)^2 + (z_i-z_s)^2 <= r^2 (i=1,...,number of points in 3d c...

4 years ago | 0

Answered
Finite difference method - Second order equation with special conditions
As your equation can be written as 1/r * d/dr (r*dT/dr) = 0 the usual discretization in r = r_i is 1/r_i * [(r_i + dr/2)*(T(r...

4 years ago | 0

Answered
3-D Bivariate Histogram
https://de.mathworks.com/matlabcentral/answers/259883-plot-histogram-for-multiple-cases-in-3-dimensions Is it this what you wan...

4 years ago | 0

| accepted

Answered
Brute force for finding optimal value
I don't understand. Your function has a single maximum at x=0.25+pi/2. Why are you talking about 10 x-values ? Do you perhaps m...

4 years ago | 0

Answered
Issues with undefined variables in curve fitting
data = readmatrix("RAW_Zener_Diode_I-V_Data.xlsx") ; vD = data(:,1); iD = data(:,2); zener_response = @(p,vD)(p(1).*(exp(p(3...

4 years ago | 0

Answered
Need help writing this equation in MATLAB
phi = rand(20,1); p = 2*prod(1-phi); psi = sum(phi.*(1-phi))/p;

4 years ago | 0

Answered
How to plot data on a curved surface.
You mean a=1; b=1; x=-a/2:0.01:a/2; y=-b/2:0.01:b/2; [X,Y] = meshgrid(x,y); F = cos(pi*X/1).*cos(pi*Y/1) surf(X,Y,F) ?

4 years ago | 0

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

Load more