Answered
how to store vectors into matrix
m = 10 ; n = 4 ; A = zeros(m,n) ; for i = 1:m A(i,:) = rand(1,n) ; end

6 years ago | 0

Answered
replace value in many colone to one value
mtx = [1 1 0 1; 2 0 1 1; 3 1 1 1; 4 1 1 0; 5 1 1 ...

6 years ago | 0

Answered
How to discover intersecting circles
You have center C and Radius R of circles. You can form the coordinates i.e (x,y) points of circle using: m = 500 ; th = lin...

6 years ago | 0

Answered
Unable to plot multiple graphs using a loop, only plots final graph
for i = 1:28 fid = fopen(ASCname{i},'r'); %ACSname is a cell containing the names of the files d= textscan(fid,'%f%f',...

6 years ago | 0

| accepted

Answered
2D Mesh interpolation or calculation effeciency
You need not to find the indices.....you have to do interpolation. Read about interp2. If X, Y, Z are your bigger grid data. A...

6 years ago | 0

Answered
Avoid overwriting of results in for loop
You canmake your output matrix a 3D. clc; clear all ; output = zeros(10,4,10); for f = 1:1:10 if (f>=1) && (f<=9) ...

6 years ago | 0

Answered
save output values in for loop to text file
for f = 1:1:10 if (f>=1) && (f<=9) fname_strt = 'B0000' ; elseif (f>=10) && (f<=99) fname_strt='B000...

6 years ago | 0

Answered
Black Body and plotting
W =[0:1:3000]; t=6000; f=((1.19104*10^(-16))./(W.^5)).*(exp(0.014387769./(W*t))-1); plot(W,f)

6 years ago | 0

| accepted

Answered
How to speed up the way to find indexes from a large nx2 matrix and create a new matrix?
Instead of using find or getting the indices. I would suggest you to go for interp1.

6 years ago | 0

Answered
Solving trigonometric equation (decoupling)
Hand calculation is also possible..... syms phi psi theta eqn = cos(psi)*sin(phi)+cos(theta)*sin(phi)-cos(phi)*sin(psi)*sin(t...

6 years ago | 1

Answered
How to solve this question?
Read about MATLAB indexing. You can get odd indices using 1:2:end You can get even indices using 2:2:end. For sketching, re...

6 years ago | 0

Answered
I plot a contour with Z value with specific value
c = contour() c also carries the points (x,y) of each/ different level which you have specififed. You can pick the points (x,y)...

6 years ago | 0

| accepted

Answered
How to fix number of points of a cone using Matlab
r1=input('enter radius '); m = input('enter number of points you want along radius') ; r = linspace(r1,0,m); h = input('ente...

6 years ago | 1

Answered
how to modify data values for multiple text files
txtFiles = dir("*.txt") ; N = length(txtFiles) ; for i = 1:N thisFile = txtFile(i).name ; % do what you want en...

6 years ago | 0

| accepted

Answered
How to find the next closest point in an array using for loops
Read about knnsearch.

6 years ago | 0

Answered
How to apply rotation on last few points ?
To rotate only last two points, you can use. Rotation=initialPoints(end-2:end,:) *R;

6 years ago | 0

| accepted

Answered
Change the colour of individual markers in the plot
x1 = linspace(0.974,1.366,9) ; x2 = linspace(0.929,1.321,11) ; x3 = linspace(0.848643,1.240643,14); x4 = linspace(0.779,1.171...

6 years ago | 0

| accepted

Answered
scattering a graph between specific points
Two cases: Case 1: If the points are equidistant x1 = linspace(0.97,1.36,9) ; x2 = linspace(0.93,1.32,11) ; y1 = zeros(siz...

6 years ago | 0

| accepted

Answered
Find the value x
The value of x would be e i.e exp(1). Check the below: x = linspace(0,5,10^6) ; % as you said x lies in [0 5] f = x.^exp(1...

6 years ago | 2

Answered
Double the values of an 2D array
Let A be your n*2 matrix. To double from second row use: A(2:end,:) = 2*A(2:end,:) ;

6 years ago | 0

| accepted

Answered
Symbolic Derivative in matlab
You can carry on symbolic calculations. Read about diff. https://www.mathworks.com/help/symbolic/diff.html

6 years ago | 0

| accepted

Answered
filtering out negative values and zeroes from .txt data file
Let A be an array..you can remove the negative values using: A(A<0) = [] ; % this remove all negative values A(A<=0) = [] ...

6 years ago | 0

Answered
Interpolating two different size of tables
REad about interp1. Torque1ms = interp1(Ts,Torque,Ts1ms) ;

6 years ago | 0

| accepted

Answered
Pick values around an index
How about this? A = rand(15,1) ; A(1)= 0 ; A(6) = 0 ; A(10) = 0 ; idx = A==0 ; idy = 1+cumsum(idx); idz = 1:leng...

6 years ago | 0

Answered
Time consumed by a function in a code
Read about profiler. You can use tic toc. t1 = tic ; val = myfunction(inputs) ; t1 = toc(t1) ;

6 years ago | 1

Answered
contour plot for nodal displacement?
scatter(x,y,25,u,'filled') colorbar

6 years ago | 0

| accepted

Solved


Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

6 years ago

Solved


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

6 years ago

Answered
What does mean .* and ' ?
.* this mean element by element multiplication. https://www.mathworks.com/help/matlab/ref/times.html Example: A = [1 2 ; 3 4]...

6 years ago | 1

Answered
Matrix Determination Issue in getting hidden inputs
function Determinant = matr(A,B) Reversed_Matrix= flip(A.* B) ; Determinant= det(Reversed_Matrix) ; end Save the...

6 years ago | 0

Load more