Answered
read the first 3 lines of a file and extract variables without reading the rest
fid = fopen('file.txt'); tline = fgetl(fid); val = cell(3,1) ; n = 1 ; val{n} = str2double(regexprep(tline, {'\D*([\d\....

5 years ago | 0

Answered
how to plot y(t)
Check the expressions thoroughly....not sure did I enter correct. fs=10; Ts = 1/fs; c = 10; t = -1:0.01:1; b=1...

5 years ago | 1

Answered
2D interpolation of scattered data
x = [1 2 3 4 5]; y = [1 2 3 4 5]; z = [1 2 1 2 3; 3 4 3 4 5; 5 6 5 6 7; 3 4 3 4 5; 1 2 1 2 3]; [X,Y] = meshgrid(x,y) ; i...

5 years ago | 1

| accepted

Answered
How can i count the number of point in each grid?
Get each box coordinates, this box is a polygon and then use the function inpolygon. Run a loop for each box.

5 years ago | 0

Answered
how to plot of a infinite series in 2D
Hints: Define x as an array using linspace after defining min and max value of x. Define t as an array using linspace after d...

5 years ago | 0

Answered
How to implement the Fourier series method of heat equation?
You shoul dhave a look on symbolic math toolbox. Rfer this answer: https://in.mathworks.com/matlabcentral/answers/413890-the-ex...

5 years ago | 0

Answered
I have encountered a problem and would like to ask everyone to help solve it. The problem to be solved is how to close the following two fitted curves. Thank you very much for your enthusiastic answers.
load dataA.mat %x1=dataA(:,1); %y1=dataA(:,2); f1 = fit(xAbove,yAbove,'smoothingspline','SmoothingParam',0.0001);%smoothingsp...

5 years ago | 0

| accepted

Answered
3D figure with different faces color
Read about surf, patch, fill, fill3.

5 years ago | 0

Answered
Limit Lines/Plane on a 3D Plot
In 3D your (x,y) points remain same on the line and your z coordinate will vary. You can write a small function for you need. ...

5 years ago | 0

Answered
Hello everyone, how do you fit two curves into a closed curve?My code is as follows.
load dataA ; load dataB ; C1 = [xAbove yAbove] ; C2 = [xBelow yBelow] ; % MErge them C = [C1 ;C2] ; idx = boundary(C(:,...

5 years ago | 0

Answered
Laplace equation, FEM
This is the book for you: https://www.amazon.in/Finite-Element-Mechanical-Aerospace-Engineering/dp/0849300967

5 years ago | 0

| accepted

Answered
Hello everyone, how to divide a piece of data into upper and lower parts along the y-axis with C point and D point as the boundary?
Option 1: You should get the indices of C, D in the given points of curve. Read about knnsearch, this will give indices of point...

5 years ago | 0

Answered
How to convert 8 Binary images of size 256 x 256 into a Grayscale image of same size, i.e., 256 x 256?
images = dir('*.tiff'); N = length(images) ; iwant = cell(N,1) ; for i = 1:N iwant{i} = imread(images(i).name) ; ...

5 years ago | 0

Answered
How to merge data with latitude and longitude?
latitude = [-3.63965:-0.00449:-8.12601]; longitude = [-37.5098:0.00453:-32.9831]; [matrix_latitude, matrix_longitude] = meshg...

5 years ago | 0

Answered
finding last column values
Let A be your 12094*3 matrix and P be your 7*2 matrix. idx = inpolygon(A(:,1),A(:,2),P(:,1),P(:,2)) ; iwant = A(idx,:) ;

5 years ago | 1

| accepted

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values. can anyone help me solve the problem?
T_1=tf(num1(1,:),den1); The above line is ridiculous. Points to note: tf is a scalar whose value is 20. Why indexing? num1 h...

5 years ago | 0

| accepted

Answered
Counting Specific Number of Consecutive Values in a Matrix
A = [1 0 0 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1]; % First column x =...

5 years ago | 1

Answered
pi approximation using a series
x = 0 ; n = 0 ; while ~(abs(pi-x) <= 10^-4 ) x = x+4*(-1)^n/(2*n+1) ; n = n+1 ; end

5 years ago | 0

| accepted

Answered
MATLAB code by using nested loop
Read about for loop. Read about fprintf.

5 years ago | 0

Answered
Matlab interpolation between two surfaces
Have a look on slice.

5 years ago | 0

Answered
solve non linear equations
Replace the first line: lear all with clear all Also terminate the output of each line using ;

5 years ago | 0

Answered
Concatenate arrays in MATLAB and Change Column name of Table
t = [10 20 30; 40 50 60]; A = t(:,1) ; B = t(:,2) ; C = t(:,3) ; T = table(A,B,C)

5 years ago | 0

Answered
Function problem in loop
function out=fns1(X) x1=X(:,1); x2=X(:,2); x3=X(:,3); x4=X(:,4); x5=X(:,5); x6=X(:,6); x7=X(:,7); x8=X(:,8); x9=X(:,9);...

5 years ago | 1

Answered
How to set Reallyl Basic iterative sum
% f = n*sin(n*x) ; thesum = 0 ; for n = 1:10 thesum = thesum+n*sin(n*x); end

5 years ago | 0

| accepted

Answered
How to make a file size smaller when export as a netcdf?
Convert the variables to single and then write to nc file. Read about Single.

5 years ago | 0

| accepted

Answered
Contour plot for the external data
simData = importdata('eField_sample.txt'); % import data x_val = simData.data(:,1); % x-coordinate y_val = simData.data(:,2); ...

5 years ago | 0

| accepted

Answered
Create equations in a loop
% K*t = F t = K\F ; Refer more: https://in.mathworks.com/help/matlab/ref/mldivide.html

5 years ago | 1

Answered
Correlation of rows of matrix B with rows of reference matrix A
[r,c]=size(matA); x = zeros(length(r),1) ; for i=1:r x(i) = corr(matA(i,:)',matB(i,:)') ; end [val,idx] = max(x)

5 years ago | 0

Answered
Hello everyone, I would like to ask a question. How to plot only the (-pi:+pi) range of the following curve.
load jizuobiao2.mat THETA12 = linspace(-pi,+pi,length(RHO12)) ; f2 = fit(THETA12,RHO12,'smoothingspline','SmoothingParam',0.99...

5 years ago | 0

| accepted

Load more