Answered
Create a vector with for loop with mathematical operations
Read about ., element by element operations. w = [5 4 3 2] ; a = 1./(w+w) ; b = w.^w ; c = w./sqrt(w) ; d = w.^2./w.^w ;...

6 years ago | 0

| accepted

Answered
How to add another condition for the indexing of certain elements in an array.
Read about max and min. You can specify the dimension i.e you want max, min along row or column. If A is your matrix. You ca...

6 years ago | 1

Answered
How to plot phase plane only using trajectory equation?
t = 0:0.01:10 ; % define your time step C = 1 ; % constant traj = C*exp(-6*t) ; plot(t,traj)

6 years ago | 0

Answered
How to adjust centers and radii of three intersected spheres to get the desired shape using matlab
clc; clear all ; r = [1 1. 1.] ; % radii of three spheres P = [1. 1. 0; -1 0. 0.; 1. -1. 0. ] ; % centers of sphere m = ...

6 years ago | 1

Answered
Array of 1's and -1's
N = 20 ; A = ones(1,N) ; A(2:2:end) = -1 ; B = repamt(A,N,1) ;

6 years ago | 0

Answered
Using a matrix values to point to another matrix rows&cols
M3 = M1(M2(:,2),:);

6 years ago | 0

| accepted

Answered
Array indices must be positive integers or logical values.
x = linspace(0,10,1000)'; y1 =cos(x).^2.*exp(-0.4.*x) ; It is array operation...you don't need to index.

6 years ago | 0

| accepted

Answered
Creating circles in matlab
You can draw a circle using: th = linspace(0,2*pi) ; R = 1 ; % Radius C = [1. 1.] ; % center x = C(1)+R*cos(th) ; y = ...

6 years ago | 0

Answered
How to obtain wireframe plot ?
Read about trimesh, triplot, mesh.

6 years ago | 0

Answered
How to extract X value given Y value from graph.
[Y,idx] = unique(Y) ; X = X(idx) ; iwant = interp1(Y,X,15)

6 years ago | 3

| accepted

Answered
Where to find matlab projects?
https://in.mathworks.com/moler/exm/chapters.html https://www.amazon.in/Numerical-Methods-Engineers-Steven-Chapra/dp/007340106...

6 years ago | 0

| accepted

Answered
how do I store an array of functions?
i = 0:170 ; f = @(u) 2./(pi*sqrt(1-((sin(i/2).^2).*(sin(u).^2)))); f = f(i) ; plot(i,f)

6 years ago | 0

Answered
unique function usage at interp1 interpolation
num = xlsread("DEfault Dataset4.csv") ; x_data = num(:,1) ; y_data = num(:,2) ; plot(x_data,y_data) [x, index] = unique...

6 years ago | 0

Answered
How to skip zero columns with MatLab?
Check the demo example: A = rand(10) ; % Replace few columns with zero dor demo [m,n] = size(A) ; A(:,3) = 0 ; A(:,9) ...

6 years ago | 0

Answered
How can I add different color to different portion of the plot?
Follow something like this. x = 1:4 ; y = sort(rand(size(x))) ; % Region 1 x1 = [x(1) x(1) x(2) x(2)] ; y1 = [0 y(1) y...

6 years ago | 1

Answered
Compare two excel sheets that contain coordinates (latitudes&Longitudes)
Read excel files into MATLAB using xlaread, readtable. You can get the nearest points and distance using knnsearch. Read about...

6 years ago | 0

| accepted

Answered
Can I solve this Matrix multiple of question?
A = rand(4) ; % matrix must be square x = rand ; % some value of x iwant = A(2,:)*x*A(:,2)

6 years ago | 0

| accepted

Answered
How to find a pixel which has the highest value? (grayscale image)
As I is a matrix,, you have to use max twice or use an array instead of matrix. max_pixel = max(max(a)) ; min_pixel = min(mi...

6 years ago | 1

| accepted

Answered
mathematical model into matlab
Method 1 Anonymous Function q = @(t) (6.25* 10^9)/(t+500)^3 ; q(1) Method 2 t = 1 ; q = (6.25* 10^9)/(t+500)^3 ; If you...

6 years ago | 0

Answered
how does a function invoke the inputs?
It is because, your type = '1' needs only two inputs a,b .. You try using type = '2' with only two inputs..it will throw error....

6 years ago | 0

Answered
for loop of vector
You need not to use loop for this: c0=2.997*10.^8; h=6.625*10.^-34; k=1.38*10.^-23; n=1; T=307; filter=linspace(1,1,100...

6 years ago | 0

| accepted

Answered
I AM TRYING TO SORT A MATRIX IN A PARTICULAR ORDER
A = rand(15,10) ; % MAtrix for demo [val,idx] = sort(sum(A,2)) ; % Get sum and arrange in descending order iwant = A(id...

6 years ago | 0

| accepted

Answered
Creating a Yes/No option for my program
Use strcmp to compare two strings. strcmp(choice,'yes') Also read about strcmpi.

6 years ago | 0

Answered
How to divide by only the even elements of matrix?
A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]; B = [20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]; % Divide E...

6 years ago | 0

Answered
Removing values before plotting graph
If X is your data and L is the number. X(X>L) = [] ; % this removes elements from X which are larger than L

6 years ago | 1

| accepted

Answered
creating a rainbow colour plot/trajectory
clc; clear all ; x = 1:50 ; y = rand(size(x)) ; z = zeros(size(x)) ; col = x; % This is the color, vary with x in this cas...

6 years ago | 0

Answered
Plot surface data which satisfies x/y condition
x = -10:1:10 ; y = -10:1:10 ; [X,Y] = meshgrid(x,y) ; idx = X+Y==5 ; Z = double(idx) ; surf(X,Y,Z) shading interp ...

6 years ago | 0

Answered
How can I find the probability of each term in the array?
A = [1,1,2,3,5,5] ; P = nnz(A==1)/length(A) % probability of 1

6 years ago | 0

Answered
double summation of a matrix
s = rand(330,332) ; m = 5 ;n = 5 ; u = 0 ; for i = -2:2 for j = -2:2 u = u+s(m+i,n+j) ; end end

6 years ago | 0

Answered
How to transpose multiple rows into one column?
num = xlsread(myfile) ; data = num(:) ; Read about fprintf, save, dlmwrite, to write the data into your required file.

6 years ago | 0

Load more