Answered
combining varying uneven matrices
m = min(size(A,1),size(B,1)); A = A(1:m,:); B = B(1:m,:);

3 years ago | 0

Answered
Unable to assign a vpasolve result from a for loop
For D = 0, there is no solution for k. And why do you solve for H0_t3 ? If Hb does not depend on H0_t3, the equation for H0_t3 i...

3 years ago | 0

| accepted

Answered
possible to reduce the relative difference for CheckGradients in optimization (fmincon)?
Why not just turning off the CheckGradient feature if you are sure your derivatives are correct within a certain error tolerance...

3 years ago | 0

Answered
How to color the space between ellipse?
v = -6:0.001:6; % plotting range from -5 to 5 [x y] = meshgrid(v); % get 2-D mesh for x and y cond1 = x.^2 + y.^2/4 >= 1; %...

3 years ago | 0

Answered
How to plot each term of a sum?
The curves seem to be almost identical. y_p = [0.478 3.218 6.322 9.451 12.586 15.724 18.863 22.002 25.143 28.283 31.424 34.565 ...

3 years ago | 0

| accepted

Answered
How do I apply an operation to certain elements in a row vector (that are less/more than a given value)
for k=1:A for i = 1:numel(x) if (0 <= x(i)) && (x(i) <= Va(k)) Q = Vb(k)*(1-(Va(k)/L))*x(i); el...

3 years ago | 0

| accepted

Answered
Matlab Matrix calculation coming wrong
% Strain calculation gauge1 = [700;300;500;500]; gauge2 = [700;300;300;700]; gauge3 = [300;700;700;300]; fig = figure; su...

3 years ago | 0

Answered
How to find minimum value and its corresponding variables for a large dataset?
@Kishore Write a function that returns Kpe1 given delta1, theta1, kh, kv and alpha1. Then you can vary the independent variable...

3 years ago | 0

Answered
'sym' returns val = k11
As you can see, there are 36 equations for 12 variables. A solution only exists that approximately satisfies the equations. sym...

3 years ago | 0

| accepted

Answered
Matrix distribution into two vectors that build similiar matrix as a vector product
But you already got the answer for the two vectors a and b and the resulting approximating matrix C: [u s v] = svd(M); n = 1; ...

3 years ago | 0

Answered
Piecewise Function Surface Plot
Hint: The function can be defined as fun = @(x,y) (2*x+2*y^2)*(x+y^2>=0 && x+y^2<=1) + (x+y^2+2)*(x+y^2>1 && x+y^2<=2);

3 years ago | 0

Answered
why do I receive ode15s error?
clc clear close all %Data k = 247; % W/mK rho = 2710; % kg/m^3 Cp = 900; % J/kg...

3 years ago | 1

| accepted

Answered
how can I plot graph of differential equations with matrix?
No mistake. MATLAB is simply not able to find an analytical solution. Instead of "dsolve", use a numerical ODE integrator, in th...

3 years ago | 0

Answered
How to find minimum value and its corresponding variables?
Add the following two lines at the end of your code: [~,idx] = min(Results(:,5)) all_values = Results(idx,:)

3 years ago | 0

| accepted

Answered
How do I get the second solution?
Pr = 1; %fixed lambda =-1.1; %mixed convection parameter (lambda) a = 0; b = 10; % b = infinity solinit = bvpinit(linspa...

3 years ago | 0

Answered
loop on matrix array
The following code computes the distance between the columns of M. M = [0 3 -1 4 6 13 -2 0 4]; D = squareform(pdi...

3 years ago | 0

Answered
fitlm - only positive coefficients
Use "lsqlin" instead. Here, you can set upper and lower bounds for the parameters.

3 years ago | 0

Answered
ODEs with Structs in codes
What is the dimension of Tdata ? And what are your Tdata ? %%%input as an array of structs for fixed value variables input.v_z...

3 years ago | 0

| accepted

Answered
How to divide a polynomial into two polynomials, one with the odd coefficients of w and the other with the even coefficients of w?
Odd part: (P(w) - P(-w))/2 Even part: (P(w) + P(-w))/2 syms w kd ki kp P(w) = 25*ki - w^4*(kd + 1) + w*(25*kp - 1)*1i + w...

3 years ago | 1

| accepted

Answered
How can I solve this?
syms PL c k eqn1 = PL * exp(-c*exp(-k*0)) == 179323; eqn2 = PL * exp(-c*exp(-k*10)) == 203302; eqn3 = PL * exp(-c*exp(-k*20)...

3 years ago | 0

Answered
How to compare the complexity of two algirthms in MATLAB
Count the number of arithmetic operations used by both depending on the input. E.g. usual matrix multiplication needs m*n*o mul...

3 years ago | 1

Answered
Computing a differential equation using a bessel function.
The solution y of this differential equation is a combination of J_0(x) and Y_0(x), the Bessel function of the first and second ...

3 years ago | 0

| accepted

Answered
Why is the Temperature curve looking like this at the end of the While loop?
tstart = 0; tend = 2.735; Tp0 = 293; dp0 = 40000*10^(-9); [T,Y] = ode15s(@fun,[tstart,tend],[Tp0;dp0]); mp = pi/6*1000*Y(:,...

3 years ago | 0

Answered
Trying to plot summation based sine signal
syms x L = 2*pi; s = rand; si = L*s; G5_6 = gamma(5/6); G1_3 = gamma(1/3); k_di = 10000/35; C = (55/9)*(G5_6/(sqrt(pi)*G1...

3 years ago | 0

| accepted

Answered
Finding value of x given y in a model fit to normcdf
yValues = [0.3333 0.5000 0.8333 1.0000 1.0000 0.8571]; xValues = [1.4000 1.8000 2.2000 2.6000 3.0000...

3 years ago | 0

Answered
perform polyfit on a semilogy plot
A = [ones(numel(t_discharge),1),t_discharge]; b = log10(Volt_discharge); x = A\b; semilogy(t_discharge,[Volt_discharge,10.^...

3 years ago | 0

| accepted

Answered
convert expression to matrix
x = 0:0.001:10; y = 3*x+2+x.^5; plot(x,y)

3 years ago | 1

| accepted

Answered
compute the indefinite integral
f = 1010; z = @(d) sawtooth(2*pi*f*d+pi,0); dstart = 0.0; dend = 0.01; delta_d = 1e-5; d = dstart:delta_d:dend; intz = cum...

3 years ago | 0

| accepted

Answered
Storing output from inner for loop after every itteration of outer for loop in nested for loops.
a=zeros(1,2); for n=1:2 sum = 0.0; for m=1:2 sum = sum + cos(n*m); end a(n)=sum; end a

3 years ago | 1

| accepted

Load more