Answered

Vectorization: incompatible sizes of arrays

n_p = 3; n_o = 3; P = rand(n_p,2); R = randi(n_p,n_p*n_o,1) IP = (cell2mat(arrayfun(@(i)vertcat(repmat(i,1,n_o)),1:n_p,'Unif...

Vectorization: incompatible sizes of arrays

n_p = 3; n_o = 3; P = rand(n_p,2); R = randi(n_p,n_p*n_o,1) IP = (cell2mat(arrayfun(@(i)vertcat(repmat(i,1,n_o)),1:n_p,'Unif...

7 days ago | 0

| accepted

Answered

how to remove error in the code?

And where is the fiunction "star4" ? Your call should be [t,C] = ode45(@star4, t, C0); % Solve the system according to the tim...

how to remove error in the code?

And where is the fiunction "star4" ? Your call should be [t,C] = ode45(@star4, t, C0); % Solve the system according to the tim...

7 days ago | 0

Answered

How can I segment a matrix based on the difference between a column's elements of the matrix?

X=[ 8.3700 -53.3090 11.4000 -116.6670 13.0000 -117.8350 26.7000 -105.8580 36.4000 -121.5060 39.40...

How can I segment a matrix based on the difference between a column's elements of the matrix?

X=[ 8.3700 -53.3090 11.4000 -116.6670 13.0000 -117.8350 26.7000 -105.8580 36.4000 -121.5060 39.40...

8 days ago | 0

| accepted

Answered

Plot the Planck's Radiation curves Below

x-axis and y-axis for the two plots have very different scales. So there must be an error in your formulae if we compare it to t...

Plot the Planck's Radiation curves Below

x-axis and y-axis for the two plots have very different scales. So there must be an error in your formulae if we compare it to t...

8 days ago | 0

Answered

Why is MatLab outputting 0s instead of the value?

E2 = (-1./(1+sec(x)))' instead of E2 = (-1/(1+sec(x)))'

Why is MatLab outputting 0s instead of the value?

E2 = (-1./(1+sec(x)))' instead of E2 = (-1/(1+sec(x)))'

8 days ago | 0

| accepted

Answered

Any comment to speed up the sum calculation of a function which includes legendre polynomials?

M = 1000; x = linspace(-1,1,M).'; y = x.'; for i = 1:11 Lpix(:,i) = legendreP(i,x); Lpjy(i,:) = legendreP(i,y); en...

Any comment to speed up the sum calculation of a function which includes legendre polynomials?

M = 1000; x = linspace(-1,1,M).'; y = x.'; for i = 1:11 Lpix(:,i) = legendreP(i,x); Lpjy(i,:) = legendreP(i,y); en...

8 days ago | 0

| accepted

Answered

matrix simultaneous equations returning 0s

Ax = 0; Ay = 0.25; Bx = 0; By = 3.25; Py = 30 + 3.5118*7; x=0.5:0.5:4; nx=length(x); y=-1:0.5:5; ny=length(y); xM=zeros(2...

matrix simultaneous equations returning 0s

Ax = 0; Ay = 0.25; Bx = 0; By = 3.25; Py = 30 + 3.5118*7; x=0.5:0.5:4; nx=length(x); y=-1:0.5:5; ny=length(y); xM=zeros(2...

8 days ago | 0

| accepted

Answered

how to store every value that i get from each iteration of for loop ?

k=1 f=2 t=rand(100); an = sin(2*pi*(2*k-1)*f*t)/(2*k-1);

how to store every value that i get from each iteration of for loop ?

k=1 f=2 t=rand(100); an = sin(2*pi*(2*k-1)*f*t)/(2*k-1);

9 days ago | 0

| accepted

Answered

How to find second intersection point?

x1 = 0:0.0001:1.5; f1 = 1./x1; f2 = sqrt(5./2 - (x1.^2)); Intersections = find(abs(f1-f2)<0.00005); xvalues=x1(Intersections...

How to find second intersection point?

x1 = 0:0.0001:1.5; f1 = 1./x1; f2 = sqrt(5./2 - (x1.^2)); Intersections = find(abs(f1-f2)<0.00005); xvalues=x1(Intersections...

9 days ago | 0

Answered

Heat transient equation not executing

The terms in your series do not agree with the formula you posted. You must decide which one is correct and which one is wrong...

Heat transient equation not executing

The terms in your series do not agree with the formula you posted. You must decide which one is correct and which one is wrong...

9 days ago | 0

Answered

How to keep a specific value in binary matrix with column constraint?

@Maria Your last question was quite interesting - so I invested some time ... If A becomes larger, you will have to work with ...

How to keep a specific value in binary matrix with column constraint?

@Maria Your last question was quite interesting - so I invested some time ... If A becomes larger, you will have to work with ...

9 days ago | 0

Answered

How to solve a large symbolic system of equations with boundary conditions

Don't solve symbolically, but numerically if you plan to work with so many equations. clearvars; clc %--- Cantidad de elemento...

How to solve a large symbolic system of equations with boundary conditions

Don't solve symbolically, but numerically if you plan to work with so many equations. clearvars; clc %--- Cantidad de elemento...

9 days ago | 1

| accepted

Answered

Why are the output variables, that I expect to be real, complex?

%Constant parameters% a = 0.005; %sheet half thickness% eps0 = 8.9*10^-12; %vacuum dielectric constant% eps_2 = 80; %water ...

Why are the output variables, that I expect to be real, complex?

%Constant parameters% a = 0.005; %sheet half thickness% eps0 = 8.9*10^-12; %vacuum dielectric constant% eps_2 = 80; %water ...

10 days ago | 0

| accepted

Answered

Euler method table problem.Why my fprintf(y(i+1)) only has the last ans, my y1-y(i+1) is incorrect and how to let the table be tidy?

h=0.002; x=0:h:1; y=zeros(size(x)); y(1)=0; n=numel(y); y1=exp(x)-x-1; for i=1:n-1 f = x(i)+y(i); y(i+1) = y(i) ...

Euler method table problem.Why my fprintf(y(i+1)) only has the last ans, my y1-y(i+1) is incorrect and how to let the table be tidy?

h=0.002; x=0:h:1; y=zeros(size(x)); y(1)=0; n=numel(y); y1=exp(x)-x-1; for i=1:n-1 f = x(i)+y(i); y(i+1) = y(i) ...

10 days ago | 1

Answered

Parameter adjust for complex functions

fminsearch also works with functions, not only function handles. fun = @(f)FUN(f(1),f(2),f(3),f(4)); f10 = ...; f20 = ...; f...

Parameter adjust for complex functions

fminsearch also works with functions, not only function handles. fun = @(f)FUN(f(1),f(2),f(3),f(4)); f10 = ...; f20 = ...; f...

10 days ago | 0

| accepted

Answered

I have a 1x6 array X = {‘a’,’b’,’c’,’d’,’e’,’f’}. I want a command that returns the element of X that contains a particular string. E.g. a command that if I tell it to find ‘d

str = ["asdfsd","bfgfd","cyf","ddfhf","effdg","dgdgdf"]; pat = "d"; [~,i] = find(contains(str,pat)==1)

I have a 1x6 array X = {‘a’,’b’,’c’,’d’,’e’,’f’}. I want a command that returns the element of X that contains a particular string. E.g. a command that if I tell it to find ‘d

str = ["asdfsd","bfgfd","cyf","ddfhf","effdg","dgdgdf"]; pat = "d"; [~,i] = find(contains(str,pat)==1)

10 days ago | 0

Answered

Solving constrained differential equations

Solving the above system is only possible in the form M = [1 0 0 0 0; ... 0 m1 0 0 0; ... 0 0 1 0 0; ... 0 0 ...

Solving constrained differential equations

Solving the above system is only possible in the form M = [1 0 0 0 0; ... 0 m1 0 0 0; ... 0 0 1 0 0; ... 0 0 ...

10 days ago | 0

| accepted

Answered

Please how do I get rid of local variables may have been changed to match the globals error?

Can you take it from here for your case ? f = @(x,a) x.^2 + a.^2; x = -2:0.01:2; a = 0:0.1:1; array = zeros(numel(a),numel(x...

Please how do I get rid of local variables may have been changed to match the globals error?

Can you take it from here for your case ? f = @(x,a) x.^2 + a.^2; x = -2:0.01:2; a = 0:0.1:1; array = zeros(numel(a),numel(x...

10 days ago | 0

| accepted

Answered

How do I add "internal" upper and lower bounds to the function lsqcurvefit?

The condition lambda_1 <= lambda_2 has to be set in A,b of the mimimizer "fmincon". "lsqcurvefit" is not suited in this case.

How do I add "internal" upper and lower bounds to the function lsqcurvefit?

The condition lambda_1 <= lambda_2 has to be set in A,b of the mimimizer "fmincon". "lsqcurvefit" is not suited in this case.

10 days ago | 0

| accepted

Answered

What is the pdf of Jakes' Model

You mean the equation of the pdf in the histogram ? theta = rand(1000000,1); v_max = 1.0; v = v_max*cos(theta); histogram(v,...

What is the pdf of Jakes' Model

You mean the equation of the pdf in the histogram ? theta = rand(1000000,1); v_max = 1.0; v = v_max*cos(theta); histogram(v,...

10 days ago | 0

Answered

lsqcurvefit with custom equation

The saturation concentration for your model is 9.35e-4. So you will never reach 5.6e-3 as in your data. Note that the infinite ...

lsqcurvefit with custom equation

The saturation concentration for your model is 9.35e-4. So you will never reach 5.6e-3 as in your data. Note that the infinite ...

10 days ago | 0

Answered

how to plot this equation

syms x y k f = y^3 + k^2*y^2 + k*y + 3; s = solve(f==0,y,'Maxdegree',3); s1 = sqrt(s); s2 = -sqrt(s); k = 0:0.1:10; s11 = ...

how to plot this equation

syms x y k f = y^3 + k^2*y^2 + k*y + 3; s = solve(f==0,y,'Maxdegree',3); s1 = sqrt(s); s2 = -sqrt(s); k = 0:0.1:10; s11 = ...

11 days ago | 0

Answered

How to convert this equation to a matlab code?

It's written as it stands: a = 0.5*[1-zeta.^2,2-zeta.^2,1-alpha,2-alpha,1-beta,2-beta]; b = [1]; c = 0.5*[0,1]; d = 0.5*[-ze...

How to convert this equation to a matlab code?

It's written as it stands: a = 0.5*[1-zeta.^2,2-zeta.^2,1-alpha,2-alpha,1-beta,2-beta]; b = [1]; c = 0.5*[0,1]; d = 0.5*[-ze...

11 days ago | 0

| accepted

Answered

Solving a system of equations symbolically

Better ? syms F0 R1 R2 d1 d2 d12 thta thta12 m1 m2 assume(thta12,'real') assume(thta, 'real') assume(thta~=0) eq1=((F0/R1...

Solving a system of equations symbolically

Better ? syms F0 R1 R2 d1 d2 d12 thta thta12 m1 m2 assume(thta12,'real') assume(thta, 'real') assume(thta~=0) eq1=((F0/R1...

11 days ago | 0

| accepted

Answered

Unable to integrate a function using integral and vpaintegral

syms x theta = 6.3*pi/180; f = (1+cosh(2*theta*x))/sinh(2*pi*x)*tanh((pi-theta)*x); vpaintegral(f,x,0,Inf)

Unable to integrate a function using integral and vpaintegral

syms x theta = 6.3*pi/180; f = (1+cosh(2*theta*x))/sinh(2*pi*x)*tanh((pi-theta)*x); vpaintegral(f,x,0,Inf)

11 days ago | 0

| accepted

Answered

Changing for loop to backslash

A = [6 -1 0 0 0; -3 3 0 0 0; 0 -1 9 0 0; 0 -1 -8 11 -2; -3 -1 0 0 4]; b = [10:10:100;repmat([0; 160; 0; 0],1,10)]; dA = decomp...

Changing for loop to backslash

A = [6 -1 0 0 0; -3 3 0 0 0; 0 -1 9 0 0; 0 -1 -8 11 -2; -3 -1 0 0 4]; b = [10:10:100;repmat([0; 160; 0; 0],1,10)]; dA = decomp...

11 days ago | 0

| accepted

Answered

my question is after ploting (x,y) , i want to count the number of signals that is above 0.5 at time for example : 1.05e-7, how to do that in matlab

xx = 1.05e-7; [~,i] = min(abs(x-xx)); count = nnz(y(i(1),:) > 0.5)

my question is after ploting (x,y) , i want to count the number of signals that is above 0.5 at time for example : 1.05e-7, how to do that in matlab

xx = 1.05e-7; [~,i] = min(abs(x-xx)); count = nnz(y(i(1),:) > 0.5)

12 days ago | 1

Answered

Fitting a hyperbola through a set of points

Remove the NaN value in the last position of data.P2 and data.I2: clear all; data=readtable("https://de.mathworks.com/matlabce...

Fitting a hyperbola through a set of points

Remove the NaN value in the last position of data.P2 and data.I2: clear all; data=readtable("https://de.mathworks.com/matlabce...

12 days ago | 1

| accepted

Answered

How to segregate data according to its temperature value?

Use MATLAB's "discretize" for the temperature array and use the so received vector Y of bins to split the vector of water levels...

How to segregate data according to its temperature value?

Use MATLAB's "discretize" for the temperature array and use the so received vector Y of bins to split the vector of water levels...

12 days ago | 0

Answered

Options for solving a system of non-linear equations

"fsolve" is the only MATLAB tool to be used for this purpose.

Options for solving a system of non-linear equations

"fsolve" is the only MATLAB tool to be used for this purpose.

12 days ago | 0

| accepted