Answered
How to extract the value of the middle point of the graph without data.
Read about interp1. xi = [2 3 4 5] ; yi = interp1(x,y,xi)

6 years ago | 0

| accepted

Answered
How can i find the dy/dx of the differantial equation
You can use gradient function. dy = gradient(y) ; dx = gradient(x) ; dydx = dy./dx ; % dy/dx

6 years ago | 0

Answered
I am having a difficulty in understanding the code.
quiver is a function which is used to plot vectorial directions. It needs locations (x,y) and the vector components (vx,vy) at t...

6 years ago | 1

| accepted

Answered
is my code below is correct?
Try this: n=input('number of elements = ') % n = 4 for i=1:n; a(i)=input('elements-'); % 1 2 5 7 end a=reshape(a...

6 years ago | 0

Answered
Create FOR loop to insert the matrix elements row-wise
n=input('number of elements = ') % n = 4 for i=1:n; a(i)=input('elements-'); % 1 2 5 7 end a=reshape(a,n/2,n/2)' ...

6 years ago | 0

Answered
How do I create a 2d animated scatter plot that charts a distribution of points (locations on a map) over time? I'm new to Matlab and am not sure how to approach the problem.
Refer this: https://www.mathworks.com/matlabcentral/answers/94495-how-can-i-create-animated-gif-images-in-matlab

6 years ago | 0

Answered
Plotting circles on a 2D graph
If you know radius and center of cricle, you can plot circle as below: C = rand(1,2) ; % center of circle R = 1. ; % RAdius ...

6 years ago | 0

| accepted

Answered
How to select certain columns of a matrix only when the values in certain rows showing the the double of the value in a particular row of a column?
Let A be your 5*n matrix. % GEt ratio R = A(1:3,:)./A(5,:) ; idx = R>=2 ; % get indices where ratio is >= 2

6 years ago | 0

| accepted

Answered
Evaluate gradient function in the for loop.
ts=0.0001; x(t)=cos(2*pi*t) % index of x is t, it cannot be, it shows error y(t)=sin(2*pi*t) vx(t)=gradient(x,ts) % index...

6 years ago | 0

Answered
extract matrix from matrix with the values of the axis
[m,n] =size(DL1) x=linspace(0,8,n); y=linspace(1,3,m); [X,Y] = meshgrid(x,y) ; % idx = DL1<2 ; idx = idx' ; iwant = [...

6 years ago | 0

| accepted

Answered
How do I save my work
Read about diary. https://www.mathworks.com/help/matlab/ref/diary.html

6 years ago | 0

Answered
Set Color of Point Cloud to the values of a vector
scatter(x,y,25,z,'filled') ; colormap(gray)

6 years ago | 1

| accepted

Answered
How do I derive a parametric slope symbolically?
syms x(t) y(t) slope = diff(y,t)/diff(x,t) % simple diff(y) can also be used

6 years ago | 0

Answered
interpolating the NaNs in Cell array - 180x1
Let (x,y) be your data where x and y are n*1 arrays each. Say you have NaN's in y and you want to fill them. idx = isnan(y) ; ...

6 years ago | 1

Answered
average selected columns with labels
Use readtable. This is suggested now. T = readtable(filename) ; mean_ChF7 = mean(T.ChF7)

6 years ago | 0

| accepted

Answered
Interpolating angle between -0.2 to 0.2 rad
x0 = -0.2 ; x1 = 0.2 ; dx = 1/1000 ; x = x0:dx:x1 ;

6 years ago | 0

| accepted

Answered
please help with this question
n = 10000 ; thesum = 0 ; for i = 1:n thesum = thesum+1/(n*(n+1)) ; end

6 years ago | 0

Answered
How to read .txt file which have complex numbers and how to separate real and imaginary parts of the complex numbers?
fid = fopen("smithchartall.txt") ; S = textscan(fid,'%f %f %f\n','HeaderLines',1) ; fclose(fid) ; C1 = S{1} ; C2 = S{2} ; ...

6 years ago | 1

| accepted

Answered
how to find out the cell array size in for loop with conditions?
Your mat file has a cell SoC2W. This is of size 60*48. Each element is a cell. You can convert it to matrix using: M = cell2mat...

6 years ago | 0

| accepted

Answered
Matrix with variable number of rows and fixed columns
As you will have variable number of values in each column, save them in the cell. [H,W] = size(BT); x = cell(W,1) ; y = cell(...

6 years ago | 0

Answered
Find slope signal change
https://www.mathworks.com/matlabcentral/answers/410698-find-time-of-slope-change https://www.mathworks.com/matlabcentral/answ...

6 years ago | 0

Answered
2D plot (x,y) with third axis (z-axis) as color bar
Read about surf, pcolor.

6 years ago | 0

Answered
plot matrix with variables
N = 100 ; t = linspace(0,2*pi,N) ; y = sin(2*pi*t) plot(t,y)

6 years ago | 0

Answered
Insert value at particular index of cell array in a loop
You can insert a number in an array on knowing the value of the element and at what position you want to insert the value. A =...

6 years ago | 4

Answered
matrix and making another matrix from it
Hint: For upper triangular major, we use: [m,n] = size(A) ; for i = 1:m for j = 1:n if i <=j A(i,j) end ...

6 years ago | 0

Answered
Finding period of EEG (peak2peak)
load("tsout.mat") ; data = tsout.MCOS ; [pks,locs]=findpeaks(data) ;

6 years ago | 0

Answered
Hi I need help with for loop
This single loop is fine enough: N = length(v_x) ; xpos = zeros(N-1,1) ; xpos(1) = 4 ; for i = 2:N-1 xpos(i) = v_x(i)*...

6 years ago | 0

| accepted

Answered
How to import data from .txt file?
data = importdata(mytextfile) ;

6 years ago | 0

| accepted

Answered
ASSIGN COMPLEX NUMBERS(X+jY) RANDOM INTEGERS BETWEEN 1 and 3
N = 5 ; C = zeros(N,1) ; for i = 1:N C(i) = randperm(3,1)+1i*randperm(3,1) ; end

6 years ago | 0

Load more