Answered
How to write an if-else statement for a function
n = 6; f = 2; for i = 2:n f = sqrt(1+f); end f finf = 0.5+sqrt(0.5^2+1)

4 years ago | 0

Answered
Which solver can solve this equation for V. Result should be around 59. I tested the to halfs of the equation on python. Thank you for your directions in the first place.
fun = @(V)((500-V)-((650.5/(((150.5-V*0.5)/(V*0.8660254037844386))+1.364))*1.364))/((((((((500*2-(500-V))/3.052050807569)*1.7320...

4 years ago | 0

| accepted

Answered
lsqcurvefit error: requires all values returned by functions to be of data type double
F3 = double(symsum(f,n,[0 Inf])); instead of F3 = symsum(f,n,[0 Inf]); Why do the elements in x0 repeat with very different a...

4 years ago | 1

Answered
How to fit data points to a known implicit function to get the parameters of the function
M = [68.8 110 68.1 178 66.75 241 64.36 297 61.04 343 57.3 380 53.26 407 49.6 430 46 445 ...

4 years ago | 0

| accepted

Answered
Creating a square matrix from 5 vectors
If the R's are row vectors: A = [R1;R2;R3;R4;R5] If they are column vectors: A = [R1,R2,R3,R4,R5]

4 years ago | 0

| accepted

Answered
where is the fault the code is not running as it has two delays with four variables?
sol = exam4() function sol = exam4 options = ddeset('Events',@exam4e); sol = dde23(@exam4f,[1, 10],[5; 0.1; 1; 7],[0, 40],opt...

4 years ago | 0

| accepted

Answered
Need help with code
Look up "Random Numbers within Specified Interval" under https://de.mathworks.com/help/matlab/ref/rand.html

4 years ago | 0

Answered
Finding Congruencing Matrix between two given matrices
https://de.mathworks.com/matlabcentral/answers/278877-how-to-findthe-permutation-matrices-that-produce-another-matrix

4 years ago | 0

Answered
How to summation using for loop with a vector
rng('default') n = 100; x = normrnd(10, 1, 1, n); y = 1 + 2 .* x + normrnd(0, 1, 1, n); xbar = mean(x) ybar = mean(y) sxy ...

4 years ago | 0

| accepted

Answered
Why do I get a size mismatch error when trying to fit a surface using an external function?
So you say function z = TestFit(x, y, n2) z = 2*x+3*y*n2; end works, but function z = TestFit(x, y, n2) % a meaningles...

4 years ago | 0

Answered
Fmincon finds no solution with break Points
The code below works. Do you have an example where it fails ? f1 =@(x) 10*(x(1)-2)^4+10*(x(1)-2)^3+10*(x(2)-2)^4+10*(x(2)-2)^...

4 years ago | 0

Answered
How to find '1' for the second time in a matrix by row wise
A = [ 0 0 1 0 0 0 0 0 1 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 1 0 1 0]; c = zeros(size(A,1),1); for i = 1:size(A,1) ...

4 years ago | 0

Answered
Fill up submatrix along third dimension with two dimensional matrix
x = NaN(3,3,4); x(1:2,1:2,:) = repmat([1 2; 3 4],1,1,4); x

4 years ago | 0

Answered
Build a Nonlinear Regression model
https://de.mathworks.com/help/stats/fitnlm.html https://de.mathworks.com/help/stats/nlinfit.html https://de.mathworks.com/help...

4 years ago | 0

Answered
How to find the maximum of symbolic equation which contains trigonometric terms?
syms gama H kv q beta phi g theta psi delta b P = 0.5*gama*((H)^2)*(1-kv)*((1+tan(beta)*tan(g))*tan(beta)+((1+tan(beta)*tan(g))...

4 years ago | 0

| accepted

Answered
How to find residual variance from fitlm
%% data x = [353.65 389.76 385.83 419.45 427.53 354.28 570.05 375.29 530.73 444.68 386.08 490.73 595.65 353.09 387.71 565.55 54...

4 years ago | 0

| accepted

Answered
Parameter covariance from lsqnonlin when using Jacobian Multiply function?
Can you form the (sparse) matrix B := [JACOB -speye(size(JACOB,1)) ; zeros(size(JACOB,2)) JACOB.'] ? Then you could try to so...

4 years ago | 0

Answered
Find a a value from a graph that is not in the array using reciprocal fit
t1= [6.22 3.59 2.68 2.53 2.19 1.82]; n= linspace(0.60,0.70,6); f1 = interp1(n,1./t1,0.653)

4 years ago | 0

| accepted

Answered
How do I take the average of elements of a vector depending on the values of another vector?
A = [2 3 2 2 3 4 3 3]; B = [0.1 0.2 0.22 0.13 0.07 0.88 0.3 0.5]; Au = unique(A,'stable'); C = arrayfun(@(i)mean(B(A==Au(i)))...

4 years ago | 0

| accepted

Answered
Least square magnitude solution
A = [1 2 3 4 5; 6 7 8 9 0]; b = [1;2]; x = lsqminnorm(A,b).' norm(x) norm(A*x.'-b) if you search for the solution for which...

4 years ago | 0

| accepted

Answered
solution of coupled differential equation
syms z11(x) z12(x) z21(x) z22(x) z31(x) z32(x) eqn1 = diff(z11) == z12; eqn2 = diff(z12) + z12 + z22 + z31 - 5 == 0; eqn3 =...

4 years ago | 1

| accepted

Answered
Solve BVP with datapoints as input variable
Pass the arrays of y-values, e_alpha and h_alpha to odefun: y_given = some 1d-array; ealpha_given = some 1d-array of the same ...

4 years ago | 0

| accepted

Answered
The difference between the results of int function and numerical solution
@Erdal Cokmez If m in your definition of f1 is an integer >0 , you can get a representation of f1 in terms of the incomplete ga...

4 years ago | 0

| accepted

Answered
I am getting Error using deval
Your integration could not be continued beyond t = 2.738123. So you try to evaluate the solution in a region where you have no...

4 years ago | 0

Answered
How can i calculate the length of curve?
I'd say Ankit's solution is the more intuitive. But Star Strider's solution should be second-order accurate while Ankit's is o...

4 years ago | 1

Answered
How do i count numbers ending in 3
x = [234 352 298 213 365 321 293 213]; n = numel(x); end_digit = zeros(n,1); for i = 1:n y = num2str(x(i)); end_digit(i...

4 years ago | 1

Answered
Solution of nonlinear equation
format long a0 = rand(1,7); %a0 = [5.3916,0.0342,1.789,0.619,-0.0104,0.2155,0.0575]; options = optimset('MaxFunEvals',1000000...

4 years ago | 0

| accepted

Answered
generate mean, variance and std using built in function
help mean help var help std

4 years ago | 0

Answered
Trapz error in calculating 2D integrals: ORDER contains an invalid permutation index
Although I have no idea of what you are doing in your code ... %q =4 case %Part I of the code a=0.25; N=100; q=1; Eigenv...

4 years ago | 0

| accepted

Answered
How can i use semi-discretization by finite differences for Pdes SYSTEM?
How do i manage all three equations related to each other? By using MATLAB's "pdepe" instead, at least if you only have one spa...

4 years ago | 0

| accepted

Load more