Answered

how to solve a system of equations in matlab

An alternate from symbolic toolbox syms x F = piecewise(x<=0, x+2, x>0, -x+2); fplot(F, [-2 2])

how to solve a system of equations in matlab

An alternate from symbolic toolbox syms x F = piecewise(x<=0, x+2, x>0, -x+2); fplot(F, [-2 2])

ungefär 2 timmar ago | 0

Answered

How I can extract an object entry from an index of cell array?

Use the curly brackets to access the content inside the cell arrays tempCell{1,1}.dist = 100;

How I can extract an object entry from an index of cell array?

Use the curly brackets to access the content inside the cell arrays tempCell{1,1}.dist = 100;

ungefär 2 timmar ago | 0

Answered

Question about constraints in optimization problems

This is due to the finite precision of floating-point numbers. Calculations on floating points numbers can accumulate errors, so...

Question about constraints in optimization problems

This is due to the finite precision of floating-point numbers. Calculations on floating points numbers can accumulate errors, so...

ungefär 2 timmar ago | 0

Answered

How to form a binary matrix from a given two vectors?

I am not sure how the elements of B are used in C. Consider following code A = 1:10; n = 10; C = arrayfun(@(x) {repmat(x, 1...

How to form a binary matrix from a given two vectors?

I am not sure how the elements of B are used in C. Consider following code A = 1:10; n = 10; C = arrayfun(@(x) {repmat(x, 1...

ungefär 3 timmar ago | 0

Answered

Determine the frequency with find and diff

You can use findpeaks(): https://www.mathworks.com/help/signal/ref/findpeaks.html or islocalmax(): https://www.mathworks.com/hel...

Determine the frequency with find and diff

You can use findpeaks(): https://www.mathworks.com/help/signal/ref/findpeaks.html or islocalmax(): https://www.mathworks.com/hel...

ungefär 5 timmar ago | 0

Answered

I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?

This is one way A = [1,0,0]; B = [0,1,0]; n = 10; X = [A; B]; t = linspace(0, 1, n+1); points = interp1([0 1], X, t) Re...

I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?

This is one way A = [1,0,0]; B = [0,1,0]; n = 10; X = [A; B]; t = linspace(0, 1, n+1); points = interp1([0 1], X, t) Re...

ungefär 21 timmar ago | 1

| accepted

Answered

Can one save the filename as a variable in 'readtable'?

you can save char arrays in a variable and then concatenate it with the extension using [] operator. filename = 'texas'; T = r...

Can one save the filename as a variable in 'readtable'?

you can save char arrays in a variable and then concatenate it with the extension using [] operator. filename = 'texas'; T = r...

ungefär 21 timmar ago | 1

Answered

difference between adjacent elements of a vector

A = [1,4,6,10,33,200]; out = A(1:end-1) - A(2:end); Read about indexing here: https://www.mathworks.com/company/newsletters/ar...

difference between adjacent elements of a vector

A = [1,4,6,10,33,200]; out = A(1:end-1) - A(2:end); Read about indexing here: https://www.mathworks.com/company/newsletters/ar...

ungefär 21 timmar ago | 0

| accepted

Answered

How to find and plot the absolut average error of a fittet curve to a Set of Data

You can add the absolute error between actual datapoints and fitted curve like this p{i} = polyfit(x_relevant{i}, y_relevant{i}...

How to find and plot the absolut average error of a fittet curve to a Set of Data

You can add the absolute error between actual datapoints and fitted curve like this p{i} = polyfit(x_relevant{i}, y_relevant{i}...

ungefär 24 timmar ago | 0

Answered

Array indices must be positive or logical values.

In MATLAB, the index of an array starts from 1 (as compared to many other languages where it starts from 0). Therefore, these li...

Array indices must be positive or logical values.

In MATLAB, the index of an array starts from 1 (as compared to many other languages where it starts from 0). Therefore, these li...

en dag ago | 2

| accepted

Answered

How to draw line graph with same values in this bar graph?

Are you looking for something like this x = [1 2 3 4 5 6 7]; temp_high = [149.1350 143.9020 19.1230 19.0350 11.8150 19.8610 1...

How to draw line graph with same values in this bar graph?

Are you looking for something like this x = [1 2 3 4 5 6 7]; temp_high = [149.1350 143.9020 19.1230 19.0350 11.8150 19.8610 1...

en dag ago | 0

Answered

why Matlab websave function doesn't work?

websave() was introduced in R2014b. There is no way to use it in R2014a.

why Matlab websave function doesn't work?

websave() was introduced in R2014b. There is no way to use it in R2014a.

en dag ago | 0

Answered

3D plot of 3 vectors

You first need to convert your data into a grid format using scattered interpolation x = data(:,1); y = data(:,2); z = data(:...

3D plot of 3 vectors

You first need to convert your data into a grid format using scattered interpolation x = data(:,1); y = data(:,2); z = data(:...

en dag ago | 0

| accepted

Answered

How to use For loop or any other loop to rearrange elements in a matrix using Matlab?

Try this M = readmatrix('Boundary_closed_1s_3s.txt'); for i = 1:size(M,1) idx1 = find(M(i,:), 1, 'first'); idx2 = ...

How to use For loop or any other loop to rearrange elements in a matrix using Matlab?

Try this M = readmatrix('Boundary_closed_1s_3s.txt'); for i = 1:size(M,1) idx1 = find(M(i,:), 1, 'first'); idx2 = ...

en dag ago | 1

Answered

How to add values at blue dots in graphs?

There is no general way. You can use text() to place the values, but to customize the location will require manual tweaking. For...

How to add values at blue dots in graphs?

There is no general way. You can use text() to place the values, but to customize the location will require manual tweaking. For...

en dag ago | 0

| accepted

Answered

how to make if accept letters?

Several problem: 1. = is an operator for assignment in MATLAB. For comparison, you need to use == if yesno == y 2. You want t...

how to make if accept letters?

Several problem: 1. = is an operator for assignment in MATLAB. For comparison, you need to use == if yesno == y 2. You want t...

en dag ago | 0

| accepted

Answered

Property validation for a vector

You can use mustBeVector validation function. properties Col {mustBeVector} end Functions are listed here: h...

Property validation for a vector

You can use mustBeVector validation function. properties Col {mustBeVector} end Functions are listed here: h...

2 dagar ago | 0

| accepted

Answered

1x2 Cell with each ?field? containing 2 values

You have 'a' like this a = {[1 2], [3 4]}; To access first elemets, you need to use indexing like this a{1,1}(1) a{1,2}(1) ...

1x2 Cell with each ?field? containing 2 values

You have 'a' like this a = {[1 2], [3 4]}; To access first elemets, you need to use indexing like this a{1,1}(1) a{1,2}(1) ...

2 dagar ago | 1

Answered

Indexing of a size() object

Unlink some other languages, such a chain of indexing is not supported in MATLAB. You can find the discussion on this issue on t...

Indexing of a size() object

Unlink some other languages, such a chain of indexing is not supported in MATLAB. You can find the discussion on this issue on t...

2 dagar ago | 1

| accepted

Answered

arg min for Optimization problem

You can use fminunc(): https://www.mathworks.com/help/optim/ug/fminunc.html or fmincon():https://www.mathworks.com/help/optim/ug...

arg min for Optimization problem

You can use fminunc(): https://www.mathworks.com/help/optim/ug/fminunc.html or fmincon():https://www.mathworks.com/help/optim/ug...

2 dagar ago | 0

Answered

add labels to x axis

Add this line at the end of your code xticklabels(X)

add labels to x axis

Add this line at the end of your code xticklabels(X)

2 dagar ago | 0

| accepted

Answered

Problem in putting limit to the variable

'x' is already in this range. You are printing the value of 'extreme_values', not 'extreme_points' syms x f=0.3*(x-0.6)*(x-0.9...

Problem in putting limit to the variable

'x' is already in this range. You are printing the value of 'extreme_values', not 'extreme_points' syms x f=0.3*(x-0.6)*(x-0.9...

2 dagar ago | 0

Answered

How can we do for following fprintf formating

It is not possible to do such thing in command window currently: https://www.mathworks.com/matlabcentral/answers/255568-putting-...

How can we do for following fprintf formating

It is not possible to do such thing in command window currently: https://www.mathworks.com/matlabcentral/answers/255568-putting-...

2 dagar ago | 0

Answered

Create matrix with two matrices

You can do something like this A = [1 2 3; 4 5 6;7 8 9]; B = [ 11 12 13;14 15 16;17 18 19]; Matrix = zeros(size(A,1)+size(B,1...

Create matrix with two matrices

You can do something like this A = [1 2 3; 4 5 6;7 8 9]; B = [ 11 12 13;14 15 16;17 18 19]; Matrix = zeros(size(A,1)+size(B,1...

2 dagar ago | 0

Answered

How to create a Nx3 array from Nx4 array

You can use cellfun() C1; % 100x1 with Nx4 matrices C2 = cellfun(@(x) {x(:,2:end)}, C1);

How to create a Nx3 array from Nx4 array

You can use cellfun() C1; % 100x1 with Nx4 matrices C2 = cellfun(@(x) {x(:,2:end)}, C1);

2 dagar ago | 0

| accepted

Answered

Non-linearly spaced axis

You need to set the xscale to 'log'. Run the following line after creating the plot xlim([0.01 1000]) set(gca, 'XScale', 'log'...

Non-linearly spaced axis

You need to set the xscale to 'log'. Run the following line after creating the plot xlim([0.01 1000]) set(gca, 'XScale', 'log'...

2 dagar ago | 0

| accepted

Answered

Plotting the given Trigonometric functions

You can use fimplicit() fun = @(x, y) y.*sin(2*x) - x.*cos(2*y); fimplicit(fun, [-10 10 -10 10])

Plotting the given Trigonometric functions

You can use fimplicit() fun = @(x, y) y.*sin(2*x) - x.*cos(2*y); fimplicit(fun, [-10 10 -10 10])

2 dagar ago | 0

| accepted

Answered

solution of a system non linear equations

If your system of equations has multiple solutions, fsolve() can only give you a single solution based on the initial point x0. ...

solution of a system non linear equations

If your system of equations has multiple solutions, fsolve() can only give you a single solution based on the initial point x0. ...

2 dagar ago | 1

Answered

how do i substract the first value from the last one on an array taking out zero values?

If all the non-zero values are in increasing order, the try this M(M~=0) = M(M~=0) - min(M(M~=0)); Result >> M = [ 0 ...

how do i substract the first value from the last one on an array taking out zero values?

If all the non-zero values are in increasing order, the try this M(M~=0) = M(M~=0) - min(M(M~=0)); Result >> M = [ 0 ...

2 dagar ago | 0

Answered

get the image from the NYu depth dataset

The screenshow shows that the dataset loads images in a 4D array. You need to specify which image you want to see. For example ...

get the image from the NYu depth dataset

The screenshow shows that the dataset loads images in a 4D array. You need to specify which image you want to see. For example ...

2 dagar ago | 0