Answered
How to write this iteration code?
Read about pdist2. You can use this to get whay you want. P = rand(4,2) ; % random data for demo iwant = pdist2(P) % the...

6 years ago | 0

Answered
Reading Contour Shape File from ArcGIS in MATLAB
As you have a shape file....you need to read that shape file into matlab. To read shape file read about shaperead. https://in....

6 years ago | 0

Answered
Scatterplot from .mat file data with loop
A = rand(15,8) ; % random data for demo [m,n] = size(A) ; % Get mean M = mean(A) ; X = repmat(1:n,m,1) ; scatter(X...

6 years ago | 0

Answered
how to separate the lat lon points into 3 polygon? Can anyone help me on this please?
As you have your limits.......(x0,y0) and (x1,y1). Make your required grid with some resolution and use interp2. x = linspace(...

6 years ago | 0

| accepted

Answered
How can i plot these problems in matlab?? I have x and y coordinate of node 3 and node 4 .
To plot the acceleration , time data you can use plot plot(Time,acceleration) To plot the frequency domain, you need to conver...

6 years ago | 0

| accepted

Answered
What function to use to solve an equation for a variable that's on both sides of the equation?
syms s a b c d e f g c = sqrt(e/(3*d*s)) ; g = c + (c*s)/(1-s) ; a = 3*c^2*d ; b = e-f*g^2 ; eqn = s - a/b==0 ; Try...

6 years ago | 0

Answered
How to calculate sum of power series
n=5; a = rand ; b = rand ; p = 0 ; for i=1:n p=p+ (a*n+1*a*n+1-b*a*n-2)/(n+2*n+1); % check the expression though end...

6 years ago | 0

| accepted

Answered
Output argument 'x' is not assigned on some execution paths.
You should not use while. Repalce it with if. function [x,y] = fcn(u) % u = battery voltage % x=1 battery charge switch %...

6 years ago | 0

Answered
Optimising Nearest Neighbor Program
N = 1000; seed = 1234; %seed=input('Random number seed = '); rng(seed) pos=rand(3,N); a = 1:N ; b = 1:N ; [a,b] = m...

6 years ago | 0

Answered
Is there any way to get numerical result from symbolic function?
You can substitute a variable value in the syms using subs and then use double, vpasolve to convert into numerica array. Read ...

6 years ago | 1

Answered
HOW CAN I FIND THE SUBSET OF N-SET?
S=[1,2,3,4] ; j=2 ; iwant = nchoosek(S,j)

6 years ago | 0

Answered
Why am I getting the error "Array indices must be positive integers or logical values."?
The error you said is simple.....in MATLAB the array indices should be always positive integers. Example: A = rand(10,3) ; ...

6 years ago | 0

Answered
Array indices must be positive integers or logical values error
The error is clear....in MATLAB the indices of an array cannot be negative, zero and fractions. Example: A = rand(10,1) ; A(...

6 years ago | 0

Answered
Lagrange polynomial giving me Inf in final form
% clc; clear all ; sp = [30 45 60 75 90 120]; mb = [2 4 9 17 27 82]; n=length(sp)-3; syms x; Q = 0; for i = 1:n+1 M =...

6 years ago | 0

Answered
A script containing if then statements
Read about input, strcmpi, strcmp, strfind, fprintf.

6 years ago | 0

Answered
Plotting of error vs iteration number matlab
clear all; clc ; close all; %Setting up the parameters dx=0.1 ; dy = dx ; Lx=1 ; Ly =1; x = (0:dx:Lx); y = (0:dy:Ly); Nx=le...

6 years ago | 0

| accepted

Answered
How to Check if array has multiples of a value and how to replace those values that are multiples with a certain assigned values
If A is your matrix. idx = mod(A,8)==0 ; % get indices which are divisible by 8 A(idx) = -6 ; % repalce the values

6 years ago | 0

| accepted

Answered
Need to erease all the rows of a matrix where a zero appears
A = [0 0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 0 0 ...

6 years ago | 0

| accepted

Answered
How to solve an ODE with ode45 in a parfor loop?
[t(:,i), S(:,i)] = ode45(@(t,s) fn(t,s,fg_vars),tspan,inital_conds) In the above t will be a column vector and S will be a colu...

6 years ago | 0

Answered
How to use for loop compare all values in a 2x2 matrix?
It is your home work...so you have to do it yourself. Follow the below hints. You can get the dimensions/ size of a matrix usi...

6 years ago | 0

| accepted

Answered
Import entire row instead of range from excel
T = readtable(file) ; % suggested data = xlsread(file) ;

6 years ago | 0

| accepted

Answered
how to locate bin center at appropriate integer value?
h = histogram(LH) ; h Now h has all the information you want. Pick the one you want.

6 years ago | 0

Answered
How to extract data?
A = rand(181,91) ; iwant = A(:,1:19) ;

6 years ago | 0

| accepted

Answered
2D and 3D graphs
Try this: num = xlsread("Test1.xlsx") ; [r,c] = size(num'); n = r/9; % Arrange the data A = permute(reshape(num,[c,r/n...

6 years ago | 0

| accepted

Answered
i need help (matlab)
Hint: Read about isequal.

6 years ago | 0

Answered
sorting table according to date/time
Convert the dates you have into class of datetime using the function datetime and then you can use sort function. Read about dat...

6 years ago | 0

Answered
Question for directional derivative.
u = @(x1,x2) x1^2-x2^2 ; % derivatives at point (1, 1) x1 = 1 ; x2 = 1 ; % derivatives dudx1 = 2*x1 ; dudx2 = -2*x2 ; ...

6 years ago | 0

Answered
how to stop executing while loop?
You can set a condition like below and exit the while loop. x=1; while x<10 x = x+1 ; end

6 years ago | 0

| accepted

Answered
Enlarging an image with spline interpolation
I = imread("image.jpeg") ; % assuming image to m*n I=rgb2gray(I); [m,n] = size(I) ; x = 1:n ; y = 1:m ; % Inteprolate to...

6 years ago | 1

| accepted

Load more