Answered
Calculate the Gradient of a given function using the forward and central quotients.
function f1x = vordiff(f,x,h,y,z) %Vorwärtsdifferenzenquotienten syms x y z ; f = (4*x+3*y+2*z)*e^(-3*x^2)-4*y^2-8*x*y-2*z^2 ...

5 years ago | 0

Answered
How to select a range of data in matrix
Let A be your column matrix. idx = A <= 44.1 ; % get indices using logical indexing iwant = A(idx) ; % Extract those elemen...

5 years ago | 1

| accepted

Answered
Loop for contour a 3 inputs function
x = linspace(-1,1) ; y = linspace(-1,1) ; z = linspace(-1,1) ; [x,y,z] = meshgrid(x,y,z) ; s = x.^2+2*x.*y.*z+y.^3+y.^...

5 years ago | 1

| accepted

Answered
How can i use symbolic variables which were created as a vector?
What you have shown will not work and it is meaning less. You have to use: x = [1 2 3 4 5 6 7 8 9]; Where veer you have x1, x...

5 years ago | 0

Answered
How can I plot 4-dimensional plot?
Have a look on slice. T = readtable('Book1.xlsx') ; l1 = T.l1 ; l2 = T.l2 ; l3 = T.l3 ; Lz = T.Lz ; nx = length(un...

5 years ago | 0

Answered
How to identify biggest location plot of random plotting
You need to sort the distance and pick the required number of points you want, to get the points from A close to BS. n = 50; ...

5 years ago | 0

| accepted

Answered
How to generate video file from animated plot in Matlab?
It is because, you are writitng only the last frame into video...you need to keep the video writer code into a loop. x = linsp...

5 years ago | 1

| accepted

Answered
Creating a matrix of all possible combinations given multiple vectors
REad about perms and nchoosek.

5 years ago | 0

Answered
How can we generate random numbers between two negative values.
a = -5 ; b = -1.670000000000000 ; r = (b-a).*rand(1000,1) + a;

5 years ago | 2

| accepted

Answered
Find the under condition min or max of a row vector
a = [ 1 3 5 2 5 7 8 3 6 4 9 ] ; a(a<3) = NaN ; % Replace values <3 to NaN [val,idx] = min(a)

5 years ago | 0

| accepted

Answered
How to use for loop
user_input = fprintf('%.1f\n', input('Enter a positive real number')); count = 0 ; while count <= 10 if user_input >= 0 ...

5 years ago | 1

Answered
How to make a color sphere as colorbar in 3D image
[X,Y,Z] = sphere; surf(X,Y,Z) colorbar

5 years ago | 0

Answered
x and fx matrix
x = linspace(0,11,10) ; f = 2*x ; iwant = [x;f]

5 years ago | 0

| accepted

Answered
I am trying to plot x and y with y being the only unknown but I don’t what is wrong in my code please help
Your x is an array Where as theta is only a scalar. You have to make theta and x both arrays of same size. You need to use...

5 years ago | 0

Answered
Open specific format file outside MATLAB ?
Right click on the C file...click on the "open with" and the choose "choose default program", after this selct your visula studi...

5 years ago | 0

Answered
Trim only edge NaN values
X = [NaN, NaN, 2, 5, 1, 6, NaN, 1, NaN, NaN]; A = isnan(X) ; idx = find(A & diff([0 A]) == 1 & diff([A 0]) == 0) ; idx = [...

5 years ago | 0

| accepted

Answered
Abaqus input file edit as required by user
Refer this: https://in.mathworks.com/matlabcentral/answers/307258-extract-nodes-and-elements-from-abaqus-input-file-to-matlab ...

5 years ago | 0

Answered
Get all unique combinations from cell array for use as functional arguments
A 2*2 matrix means there are four elements i.e. four global indices. idx = 1:4 ; c = nchoosek(idx,2) C has the possible comb...

5 years ago | 0

| accepted

Answered
Derivative without diff function
You should proceed something like this: fun = @(y,t) y/t; t = linspace(0,60,500) ; y = sin(t) ; df = zeros(length(t)-1) ...

5 years ago | 0

Answered
Hello everyone, how can I plot the following six curves on a graph? More importantly, compare the similarity of the six curves.
Read about hold on to plot all the curves in a single plot...you can give legend ti differentiate the each curve. To get similia...

5 years ago | 0

Answered
chop array and average
data = [1 0 2 0 4 1 6 1 7 1 4 2 3 2 1 0 7 0 2 1 5 0 6 0 2 2] ; A = zeros(1...

5 years ago | 0

Answered
finding the smallest euclidean distance of one point (lon & lat) to two matrices one containing lon the other lat
REad about knnsearch. This will give you the required number of indices along with distances closest to the given point.

5 years ago | 0

Answered
How to plot contourf using following information?
pr is a 3D matrix, you cannot use contourf on a 3D matrix. You need to draw layer by layer. [m,n,p] = size(pr) ; for i = 1:p...

5 years ago | 1

| accepted

Answered
how to duplicate rows in a 2D matrix
A = magic(4); A(2,:) = A(1,:)

5 years ago | 0

| accepted

Answered
Remove parenthesis and the contents inside from a string
A = 'abc (ABC)' ; idx = strfind(A,' (') ; iwant = A(1:idx-1)

5 years ago | 0

Answered
How to divide two datasets element wise ?
iwant = data_CP./data_PYP*1000 ;

5 years ago | 0

| accepted

Answered
How to average columns of matrix without loop?
There are functions possible to do the said. Read about movemean, blockproc, reshape.

5 years ago | 1

Load more