Answered
how can i use simulated annealing for calculating the regression coefficients?
It's not simulated annealing, but most probably much faster. M = [3979278.479 654200.79 35.38 -27.86 4196516.825 554782.87...

3 years ago | 0

Answered
pointwise multiplication of sparse matrix with full array
rand(2,2,2,2) generates a (2x2x2x2) array for B. You cannot multiply A with such a B elementwise because the array sizes don't m...

3 years ago | 0

| accepted

Answered
Generating random circles/ellipses inside circular domain
Maybe you could generate the circles/ellipses in a square domain with side length R (the radius of your circular shape) and fina...

3 years ago | 0

Answered
A positive root of an equation
Without further knowledge about the background of your question: Maybe by setting (r(M)(a+P(M))(K-d))/(bK) instead of M in your...

3 years ago | 0

| accepted

Answered
Convex quadratic problem on two variables
fminimax. min_d max_j (g_j^t*d + 0.5*d^t*B_j*d) And the solution variables have to be put in one vector x that can comprise as...

3 years ago | 0

| accepted

Answered
Finding roots of a two variable function
x = rand(10,1); fun = @(z)BirnbaumSaunders(z(1),z(2),x); z = fsolve(fun,[0.65,2.13]) norm(fun(z)) function f = BirnbaumSau...

3 years ago | 0

Answered
Data Analysis - Matlab Code
D = randi([-5, 5],4,2) Cn = eye(size(D,1))-1/size(D,1)*ones(size(D,1)) D_centered = Cn*D mean(D_centered,1)

3 years ago | 1

| accepted

Answered
How to find x value for a known Y in array?
x = 0.1:0.1:4*pi-0.1; y = sin(x); i = find(y(1:end-1).*y(2:end) <= 0) x_root = x(i)-y(i).*(x(i+1)-x(i))./(y(i+1)-y(i)) [pi,2...

3 years ago | 0

| accepted

Answered
How do I convert a cell array with multiple values per cell into a numerical array with multiple rows?
n = 13; C = cell(1,n); for i=1:n C{i} = rand(5,1); end A = cell2mat(C) class(A)

3 years ago | 1

Answered
Hello everybody. I need your help. I need to display an image (.jpg) and would like it to close after 5 seconds. How could I do?
https://de.mathworks.com/matlabcentral/answers/1614610-how-to-display-any-image-for-500-ms

3 years ago | 0

Answered
How can I add two curves that don't share the same x-axis values?
T = union(t1,t2); Y1 = interp1(t1,y1,T,[],'extrap'); Y2 = interp1(t2,y2,T,[],'extrap'); diffY = Y1-Y2 plot(T,diffY)

3 years ago | 0

| accepted

Answered
using x vector input to find corresponding y value
Three possible solutions: x = [-2:0.5:16.5]; y = findingy1(x); figure(1) plot(x,y) y = findingy2(x); figure(2) plot(x,y) ...

3 years ago | 0

Answered
Find the rows have two same elements from a matrix
A = [1 9 8 2 7 8 5 8 9 6 5 4 7 3 8 5 4 8]; [I,J] = meshgrid(1:size(A,1),1:size(A,1)); [rows cols...

3 years ago | 0

| accepted

Answered
Why am I getting inf even though there is no divide by zero?
while 1 Pi_sat=A-B./(to+C) alpha=Pi_sat/Pi_sat(k) ... instead of while 1 for i=1:n ...

3 years ago | 0

Answered
Issue defending a variable in MATLAB APP Desinger
If fs is a vector of values, you have to use elementwise division: 1./fs instead of 1/fs Same for m_k = app.amp.*cos(2*pi*...

3 years ago | 0

| accepted

Answered
I want to multiply a vector by a number and calculate the sum of all the values.
A = [18;15;125;48;78;69;48;15;12;2]; s = cumsum(A)

3 years ago | 1

Answered
Integration of Numeric Data in cycle
Work on your data first so that you get a closed, non-overlapping curve. Especially "clean" the upper and the right part. Then a...

3 years ago | 0

Answered
How to set Dirichlet boundary condition on 1-D poisson equation FEM
It is hard to follow your coding, but my guess is that the boundary conditions at both ends are not incorporated in the linear s...

3 years ago | 0

Answered
Plotting a multivariable function, that also has a summation
xstart = 0.0; xend = 1.0; nx = 100; tstart = 0.0; tend = 5.0; nt = 100; nsum = 31; X = linspace(xstart,xend,nx); T...

3 years ago | 0

| accepted

Answered
while loop or loop
prompt = "Input x "; x = input(prompt) while x > 2500 && x < 2501 disp("Wrong value for x") disp("x must not be in the i...

3 years ago | 0

Answered
How can I find the coeficients alpha, beta of the simple linear regression, using polyfit function?
x = (0:0.1:1).'; y = 3*x + 4 + 0.01*randn(numel(x),1); polyfit(x,y,1)

3 years ago | 0

| accepted

Answered
How can I find the coeficients alpha, beta of the simple linear regression, using "\" operator
x = (0:0.1:1).'; y = 3*x + 4 + 0.01*randn(numel(x),1); A = [x,ones(size(x))]; b = y; coeffs = A\b; coeffs(1) coeffs(2)

3 years ago | 0

Answered
ODE-Runge Kutta
Maybe of interest for comparison. Seems we get different results - also for the code with only backward differencing. But this ...

3 years ago | 0

Answered
Find which columns have duplicates
Transpose the matrix :-) Or: ColumnsWithDuplicates = find(arrayfun(@(i)(~isequal (length (unique (A(:,i))), size(A,1))), 1:siz...

3 years ago | 0

Answered
Multiple 3d random walks
lambda = 3; %Mean free path numberOfSteps = 10000; % Total number of steps numberOfPaths = 3; % Number of paths x(1,:) = ra...

3 years ago | 1

| accepted

Answered
Laplace Inversion Of Bessel Function
Try the numerical way of finding the inverse Laplace transform: https://de.mathworks.com/matlabcentral/fileexchange/39035-numer...

3 years ago | 0

| accepted

Answered
Error using / .
If T is an array of multiple temperatures, you have to use elementwise division: k = k0 * exp((-Q) ./ (R*T)) instead of k = k...

3 years ago | 0

Answered
How to implement this coupled ODE
clc,clear,close all global Ve Cd A_r g g = 9.8; % m/s^2 Cd = 0.47; r = 3.7; % m A_r = pi * r^2; rho_fuel = 1000;...

3 years ago | 0

Answered
Solving ODE with boundary conditions
You have a first-order ODE. For first-order ODEs, you can prescribe one boundary condition, not two. Or one of the parameters ...

3 years ago | 1

Answered
Help with non linear equations.
fun = @(x)[8.07-(x(1)-x(2)+x(2)*0.9^(-1/x(3)));11.82-(x(1)-x(2)+x(2)*0.5^(-1/x(3)));284.23-(x(1)-x(2)+x(2)*0.1^(-1/x(3)))]; x =...

3 years ago | 1

| accepted

Load more