Answered
Simple operations with vectors
dist(i) is one single number (a scalar), vp(i)*t is a vector of the same length as t. You can't assign a vector to a scalar ele...

4 years ago | 2

| accepted

Answered
Why am i getting length(x) as 11 instead of 16?
If you display length(x1) the answer should be 16.

4 years ago | 0

Answered
I want to code a recursive production line with input and output as arrays. I have code for scalar values, but how to switch to arrays?
Turn your script into a function, interprete your multiproduction as n single productions and call the function from above in a ...

4 years ago | 0

Answered
multiply with a vector inside for loop
% finding a_x, a_z, x_z, a_xn, display after each iteration, after each % loop, like excel :-) n = [6 5 4 3 2 1 0]; SF = [1 4...

4 years ago | 1

| accepted

Answered
Solve set of equations with multiple variables where one is time depended
You might try a numerical solution: f1 = @(x2,y2,phi2,phi3,t) x2 - 4*cos(2*pi*t) - 3*cos(phi2); f2 = @(x2,y2,phi2,phi3,t) y2 -...

4 years ago | 1

Answered
Solve set of equations with multiple variables where one is time depended
syms t phi2 phi3 x2 y2 eqn1 = x2 - 4*cos(2*pi*t) - 3*cos(phi2) == 0; eqn2 = y2 - 4*sin(2*pi*t) - 3*sin(phi2) == 0; eqn3 = 4 -...

4 years ago | 1

Answered
How to manually perform linear regression from scratch
This is the code for the manual fit: A = [ones(size(reg1(idx))),reg1(idx)]; b = reg2(idx); % linear fit equals reg2(idx)_fitt...

4 years ago | 0

| accepted

Answered
Simultanous curve fitting to multiple datasets
x1 = 0:0.1:1; x2 = 0.05:0.1:0.75; fun = @(x,a,b,c,velocity) a+b*x+velocity.*exp(c.*x); a_hat=1; b_hat=1; c_hat=1; y1 = fun(x...

4 years ago | 0

| accepted

Answered
deviation from the average value less
[m,i] = min(vecnorm(veT-mean(veT,2)))

4 years ago | 0

| accepted

Answered
how to take cube of double array?
z=y.^3

4 years ago | 0

| accepted

Answered
Saving values of a variable in while loop
errorVal(n) = sum(error(:))/((nx-2)*(ny-2));

4 years ago | 0

Answered
Matrix in matlab equation
Y = repmat(A,1000,1)

4 years ago | 0

| accepted

Answered
How to track 3 parameters with this code
k4 = dt*vossFNint(xx+k3,z(n),a(n),b(n),c(n); instead of k4 = dt*vossFNint(xx+k3,z(n)),a(n),b(n),c(n); Further I don't underst...

4 years ago | 0

| accepted

Answered
Find roots of a function with multiple inputs
And you want to solve for d ? syms d Mx tw tf b y = sym('355')/Mx*(d^2*tw/sym('12')+tf^3*b/sym('6')+tf*b*(d+tf)^2/sym('2'))-d/...

4 years ago | 0

Answered
3D Interpolation with 2 dependent function values
Unfortunately, it seems like that the required tilts (alpha and beta) are dependent on each other, which means that two separate...

4 years ago | 0

| accepted

Answered
System of equations with array inputs
function main %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%...

4 years ago | 1

Answered
How to write an 'if' script that changes a function depending on x?
function y = funk(x) if x <= 3 y = sin(x); elseif (x > 3) && (x <= 7) y = atan(x); else y = exp(-x); ...

4 years ago | 0

Answered
What is wrong with my code?
R = 8.314; T1 = 60 + 273.15; PvapH = .7583; PvapT = .3843; HvapH = 29000; HvapT = 31000; P = .7; fPva...

4 years ago | 0

| accepted

Answered
Solving System of Equations with Symbolic Toolbox
Say you want to solve eqn1 = expr1 == 0; ... eqnn = exprn == 0; Then according to what you are trying to do you can proce...

4 years ago | 0

| accepted

Answered
Problem adding delay to dde23 model
lags = [1 0.2]; a = 5; tspan = [0 5]; sol = dde23(@(t,y,Z)ddefun(t,y,Z,a), lags, @history, tspan); plot(sol.x,sol.y(1,:),'-o...

4 years ago | 0

| accepted

Answered
How do I properly subtract two column vectors of class 'Double'
You calculate v = A*x - 1 in words: A*x - one instead of v = A*x - l in words: A*x - el

4 years ago | 1

Answered
How to efficiently delete rows from very large matrix
data(any(isnan(data),2),:) = [];

4 years ago | 0

| accepted

Answered
Is this how I find the area under my graph?
% ------ Finding time to climb to each altitude ------ % time_2_5_climb = trapz(final_list_2_5(:,6),final_list_2_5(:,8)) % 924...

4 years ago | 0

| accepted

Answered
How to find the coefficient matrix of a set of nonlinear equations?
There might be more elegant solutions, but this is one way you could generalize. I did it in octave ; maybe you will have to ac...

4 years ago | 1

Answered
Unable to perform assignment because the left and right sides have a different number of elements
% Input Data Parameters h=1; % Step size [s] tf=50; % Solve Space of t=[0,tf] [s] ...

4 years ago | 1

Answered
How to define a distance along a 2D nonlinear line generated by an equation, and find the corresponding distance along the x-axis?
syms x y = 5*0.12*(0.2969*sqrt(x)-0.1260*x-0.3516*x^2+0.2843*x^3-0.1015*x^4); f = sqrt(1+(diff(y,x))^2); f = matlabFunction(f...

4 years ago | 0

Answered
define matrix with variable to iterate over
function main ev = ...; hb = ...; w = (0:0.01:4)*ev/hb; D_= zeros(9,numel(w)); for n = 1:numel(w) M = Define...

4 years ago | 1

| accepted

Answered
error using sym/subindex
syms x f(x) = sqrt(1-x^3); V = pi* int(f^2,[0,1])

4 years ago | 0

Answered
for loop does not plot all the plots
plot(24*i,y1(i*100e3),'*'); instead of plot(24*n,y1(n*100e3),'*');

4 years ago | 1

Answered
How to make a solid of revolution using a function
https://de.mathworks.com/matlabcentral/fileexchange/15559-solids-of-revolution

4 years ago | 0

Load more