답변 있음
Why is this generating a numerical array and not an array of cells?
REad about the function diff. It needs an array with atleast 1x2 dimensions. You are giving only one number as input. So diff gi...

대략 4년 전 | 0

| 수락됨

답변 있음
y =kx^n can anybody solve this
data = [1.76E-02 1.79E+07 1.92E-02 2.39E+07 2.17E-02 2.98E+07 3.92E-02 3.58E+07 1.32E-01 5.97E+07] ; x = data(:,1...

대략 4년 전 | 0

답변 있음
Read csv files and save the plots (.bmp format)
clearvars indir = '.'; %current directory outdir = 'C:\Users\gagan\Downloads\testing_lab\Stage-1 testing\plots'; %where to...

대략 4년 전 | 0

답변 있음
Matlab simulation for planet motion
t = 0; m1 = 1; m2 = 2; G = 1; pos01 = [1 2 3]; pos02 = [4 5 6]; pos1 = zeros([],3) ; pos2 = zeros([],3) ; iter = ...

대략 4년 전 | 1

답변 있음
Add grid lines onto the 3D mesh plot
[X,Y,Z] = peaks(1000) ; % data for demo surf(X,Y,Z) % this will be black shading interp % this will remove black lines...

대략 4년 전 | 0

답변 있음
How to put these values into one array ?
x = 1:8 ; f = [repmat('%d,',1,length(x)-1),'%d\n'] ; fprintf(f,x)

대략 4년 전 | 0

| 수락됨

답변 있음
How can the following code be optimized / vectorized?
I think pdist2, this inbuilt function will work for you. T = readtable('Sample.xlsx') ; A = table2array(T) ; A = A(:,3:5) ...

대략 4년 전 | 0

답변 있음
Row and Column reduction of
A = rand(4) iwant = zeros(6) ; iwant(1:4,1:4) = A B = iwant ; iwant = B(1:4,1:4)

대략 4년 전 | 0

| 수락됨

답변 있음
Having difficulties in generating correct legend in subplot
You need not to use loop. I have edited the code, check it. n=[300 600]; for m=1:length(n) t_0=0; t_n=3; h=(t_...

대략 4년 전 | 0

답변 있음
How to call a function to read some files from a specific folder?
thepath = 'D:\...\multiparts test2' ; filename1 = [thepath,filesep,'lineinjection.dpm'] ; filename2 = [thepath,filesep,'linei...

대략 4년 전 | 0

| 수락됨

답변 있음
I want to find area under the curve
x=[0.4166 0.5882 1.0526 2.3419 3.5273 9.433]; y=[0.912 0.933 0.9475 0.9677 0.984 0.999] ; % Make the curve closed P = [ma...

대략 4년 전 | 0

답변 있음
How can I generate n*(n^2) matrix with n 1's per row, indented n times?
n = 4 ; A = zeros(n,n,n) ; for i = 1:n A(i,:,i) = ones(n,1) ; end A = reshape(permute(A,[1,2,3]),size(A,2),[])

대략 4년 전 | 0

| 수락됨

답변 있음
How to get the multiplication of elements in a row vector by using for loop
% create a vector A = [-2,4,9,-5,1]; Mult = 1; % <----- this should be 1 % create a for loop for i = 1:length(A) Mul...

대략 4년 전 | 1

| 수락됨

답변 있음
How to generate a sequence in MATLAB?
m = 10 ; n = 10 ; % decide till what number you want to end C1 = (1:n)' ; C2 = m/2-(0:n-1)' ; C3 = [m ; m/2+(1:n-1)'] ; ...

대략 4년 전 | 1

| 수락됨

답변 있음
How to calculate R^2 based on external linear equation?
Substitute your x in th equation y = mx+c, get (x1,y1) and let (x0,y0) be your old existing values. Then you can use regressio...

대략 4년 전 | 0

답변 있음
Finding maximum value and its location in an array
REad about the function max. If v is your array. [val,idx] = max(v)

대략 4년 전 | 0

답변 있음
Create txt file from each row of Matrix
A = rand(3,10) ; for i = 1:3 fid = fopen([num2str(i),'.txt'],'w') ; fprintf(fid,'%f\n',A(i,:)) ; fclose(fid) ; ...

대략 4년 전 | 2

답변 있음
How to do a circle with triangular mesh?
You may refer this: https://in.mathworks.com/matlabcentral/fileexchange/57824-mesh-a-circle-with-quadrilaterals

대략 4년 전 | 1

답변 있음
How to remove specific rows
idx = a == 0 ; % find indices of zeroes in a b(idx) = [] ; % remove the respective values from b If a is floating point...

대략 4년 전 | 1

| 수락됨

답변 있음
How do i write this code for different timestep like this code is for 3600 and i want to use different timesteps like 1800,900,450
dt = [3600 1800 900 450] ; for i = 1:length(dt) nsteps = 12; t = zeros (nsteps,1); A = zeros (nsteps,1); B = zeros(nsteps, ...

대략 4년 전 | 0

답변 있음
How to crop unwanted data from surfplot?
You should be having vertices of the triangle or your required region. USe inpolygon to get the indices of the coordinates which...

대략 4년 전 | 0

답변 있음
How to find whether the point lies with in the enclosed boundary region or not
Read about inpolygon.

대략 4년 전 | 1

답변 있음
How to plot 3D surface with the given points in excel
T = readtable(myexcelfile) ; x = T.(1) ; y = T.(2) ; z = T.(3) ; %%structured xi = unique(x) ; yi = unique(y) ; [X,Y] = me...

대략 4년 전 | 1

| 수락됨

답변 있음
How to extract data from an array
Let x be your signal and val be yout threshold. val = 50000 ; tol = 10^-3 ; idx = find(abs(sig-val)<=tol) ; % this gives th...

대략 4년 전 | 0

답변 있음
Create a double identity matrix matlab
M=12; K=eye(M); K(2:1+size(K,1):end) = 1

대략 4년 전 | 0

답변 있음
Combining two vectors into a new one
A = rand(3) ; B = rand(2) ; idx = knnsearch(B(:),A(:)) Also have a look on ismember, ismembertol.

대략 4년 전 | 1

답변 있음
Input data from another script
x = 1:1:100 ; for i = 1:length(x) xi = x(i) ; % input xi to your function and do what you want end

대략 4년 전 | 0

답변 있음
How to apply dec2bin to char array?
a ='1234567'; dec2bin(str2num(a))

대략 4년 전 | 1

답변 있음
Error using cos Not enough input arguments. HELP
(cos(5*pi/6))^2.*sin(7*pi/8)^2.+tan(pi/6*ln8)/sqrt(7)

대략 4년 전 | 1

| 수락됨

답변 있음
How to fill closed curves. The code I wrote can't be implemented, I don't know how to correct it, thanks for the answer.
fig = gcf; axObjs = fig.Children; dataObjs = axObjs.Children; xt= dataObjs(1).XData; yt= dataObjs(1).YData; fill(xt,yt,'r')...

대략 4년 전 | 0

더 보기