Answered
Positive roots only for cubic eqn
ROOTS = roots([1, -5, -2, 24]); Wanted = ROOTS(ROOTS > 0)

6 years ago | 0

| accepted

Answered
array errors using n
n = 3; % a number Array = -5*n: n/100: 5*n % you were close % or perhaps syms n Array = -5*n: n/100: 5*n

6 years ago | 0

Answered
Matrix dimensions must agree for addition or subtraction
f = [1 0 1]; g = [1 0]; f - [ zeros(1, numel(f) - numel(g)), g]

6 years ago | 0

| accepted

Answered
How to use multiple variables in a name structure
compose('001_m1_60_const_20200611_200515_SNR_%d_PLL.png', (1:3).')

6 years ago | 0

Question


Why doesn't diff() recognise the second variable?
syms x(t) m1 m2 xr = x; xl = 0; T = (m1 * diff(xl)^2) / 2 + (m2 * (diff(xr)^2)) / 2 % why doesn't it recognise that xr is a f...

6 years ago | 1 answer | 0

1

answer

Answered
Select first n nonzero elements in each row of matrix
ix = cumprod(A ~= 0, 2); B = A(:, max(ix) ~= 0) %OR ix = cumprod(A ~= 0, 2); % remove cumprod(...) if you don't expect n c...

6 years ago | 0

Answered
How to sketch y>=0 and x^2+y^2<=25
You can sketch using pencil/MATLAB. doc fsurf

6 years ago | 0

Answered
How can i multiply two same dimension vectors and why this code is providing error?
Parent1= rand(3,1) Parent2=[5;2;2] Dim = 3 Off1 = Parent1 + (rand(Dim,1).*(Parent2-Parent1)); P.S: You have made a...

6 years ago | 0

Answered
how to replace duplicates with mean value in a table
<https://www.mathworks.com/help/matlab/ref/timetable.retime.html;jsessionid=187727437e865082a2118348467c#bve5nmz> - use 'secondl...

6 years ago | 0

| accepted

Answered
Undefined function or variable??
input1 =1; input2 = 2; input3 = 3; input4 = 4; results = f(input1,input2, input3, input4) % this is how you call a function...

6 years ago | 0

Answered
Error: Matrix dimensions must agree while using sin function
isequal(size(t),size(Ac)) % should return true

6 years ago | 0

Answered
cell array multiplication with number error
Shot in the dark. CHAaV = CHAamv{:,:} * 1e-3;

6 years ago | 0

Answered
How to make a matrix from the cells inside the cell?
Z = A(:,3); Wanted = cell2mat(cat(1, Z{:}))

6 years ago | 0

| accepted

Answered
Save array of names
name_save = compose('name%d', 1:numel(l)) ; % before loop name_save{k} ... inside loop

6 years ago | 1

| accepted

Answered
How to insert values for a symbolic variable
subs(f, {x1, x20}, {10, 14})

6 years ago | 1

| accepted

Answered
How to compare every elements of a vector and update its element with a new one?
min_power = (wo >= 0.90) * 1e-4 ... + ((wo >= 0.70) & (wo < 0.90)) * 1e-5 ... + (wo < 0.70) * 1e-7 *N...

6 years ago | 0

| accepted

Answered
How to `subs` with both scalar variable and arrays?
syms x syms t [1 3] g = x+t1+t2; t_vars = num2cell(t); t_vals = num2cell(1:3); result = subs(g,{x,t_vars{:}},{1...

6 years ago | 0

| accepted

Answered
Use of ":"operator in matlab?
(:) forces the matrix to a column vector, all you need is reshape(matrix, 1, [])

6 years ago | 0

| accepted

Answered
How to find general solution of second order differential equation
syms y(t) ode = diff(y,2) + 0.3*diff(y) +... 2e7*y == sin(2*pi*t); dsolve(ode)

6 years ago | 0

Answered
Error Using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.
"I = "+ I + "\n" % without fprintf(...)

6 years ago | 0

Answered
Error printing double format value
fprintf('%d', a) doc fprintf

6 years ago | 0

| accepted

Answered
How to remove rows from a table based on row value?
t5(ismember(t4{:,1},t5{:,1}), :) = []

6 years ago | 0

| accepted

Answered
How to calculate expm of a matrix?
clear expm

6 years ago | 0

Answered
Legend shows just 8 from 9 entries
Highly probable that one of your plot handle is empty.

6 years ago | 0

Answered
How do I change font size for Live Scripts?
Alternatively one can change under *view* * zoom in (cmd +) * zoom out (cmd -) P.S: On a Mac.

6 years ago | 0

Answered
how to solve in matlab comand
vpa(Z,3)

6 years ago | 0

Answered
How to plot x and y with x evaluated in a function
x = ...; y = ...; plot(Amp(x),y)

6 years ago | 0

| accepted

Answered
Convert timetable to m-by-6 matrix
doc hms doc ymd

6 years ago | 1

| accepted

Answered
How to define a new variable in a table, Part 3
Remove *(k)* and replace */* with *./*

6 years ago | 0

| accepted

Load more