Community Profile

# KSSV

### INCOIS

6,727 2011 年以降の合計貢献数

Professional Interests: Mathematical Computing

#### KSSV's バッジ

How many times does a number appear in these lines?

| 採用済み

Index of the first number divisible by 3
idx = find(mod(A,3)==0) ; iwant = idx(1)

Converting Binary Numbers to their Decimal Equivalent
Refer this: https://in.mathworks.com/matlabcentral/fileexchange/56893-binary-float-convertor

Removing a coordinate from a list of coordinates.

| 採用済み

Matrix split in vector
iwant = A(A>0) If you want in the order you have given. A = A' ; iwant = A(A>0)

convert for loop to while
i = 1 ; f = 1 ; n = 3 ; while i<=n f=f*i; i = i+1 ; end

| 採用済み

how to do a while loop to estimate pi using monte carlo method
https://in.mathworks.com/matlabcentral/fileexchange/33543-monte-carlo-method?focused=5201749&tab=function

Remove data from matrix
If A is your array.... You can remove data using: A(A>30) = [] ; A(A<25) = [] ; Or replace them with NaN's, if yu want same...

1日 前 | 1

| 採用済み

how to pull out indicies from a matrix
Let A be your 2*m matrix... r1 = A(1,:) ; r2 = A(2,:) ; iwant = r2(r1==1) iwant = r2(r1==2) From matrix directly. iwan...

1日 前 | 0

| 採用済み

Elements in array and matrix

3日 前 | 1

how can I convert many images from m x n x 3 to m x n by rgb2gray?
img = dir('*.jpeg') ; N = length(img) ; for i = 1:N thisimg = img(i).name ; I = imread(thisimg) ; Ig = rgb2...

4日 前 | 1

Plotting two variables from a loop
% Constants g=9.81; m=1.5; A=0.028; Cd=0.8; rho=1.225; B=(rho*Cd*A)/2; Dt=1e-6; % Initial values x=0; y=6.4008; %21...

4日 前 | 1

| 採用済み

plot values in the loop
p=3 ; k = 1:p ; val = zeros(1,p) ; for i = 1:length(p) %something if %something d=d+1 val(i) = ...

4日 前 | 0

How to plot an inversely proportional graph ?
plot(k,1./T) ; You can find the inverse/ reciprocal using 1./T.

5日 前 | 0

| 採用済み

How to make a function that calculates percentage change in a vector
Loop: x=csvread('gdp.csv') for i=1:length(x)-1 p = (x(i+1)-x(i))/(x(i)) end Vector: p = diff(x)./x(1:end-1) ;

5日 前 | 0

How get this program to calculate derivative properly?
Yn=A*sin(w*t); dYn = A*w*cos(w*t) ;

5日 前 | 0

converting 2D XY coordinated into Grid format
It depends whether your data is gridded or scattered. Follow the below code to get what you want. Let A be your m*2 array. x =...

6日 前 | 0

Area of intersection of two ellipses
You can follow the below steps. For the two ellipses i.e get coordinates of both the ellipses. Let L1, L2 be your coordinates ...

7日 前 | 0

| 採用済み

Common numbers between arrays

7日 前 | 1

I can’t get the program to run for some reason. I want to use for loops for this program.
You need not to use two for loops.....that is a wrong idea. This is what you should do: Ti = 0; Tinc = pi/180; Tf = pi...

8日 前 | 0

need Matlab program to count the number of lines until dollar sign is given

8日 前 | 0

Single line of code for vectorization, Need Help!!
r = [0.1 0.2 0.3 0.4 0.5] ; h = [0.2 0.3 0.4 0.5] ; [r,h] = meshgrid(r,h) ; v = 1/3*pi*r.^r.*h ;

8日 前 | 0

How do you detect duplicate values within a random array?
If you want to use inbuilt functions......you can use unique. Read about it. Let A be your array. B = unique(A) ; if lengt...

8日 前 | 0

| 採用済み

Plotting question using data (water saturation)
sat_data = water_sattemp_data ; plot(sat_data(:,1),sat_data(:,2)) ;

8日 前 | 0

Adding Array elements from one element to another
Let A be your array. iwant = sum(A(487146:513795)) ;

8日 前 | 0

| 採用済み

Identifying the circle that fits the outer white pixels in a binary image (or make external mask)
I = imread("SampleXRmorph.PNG"); [y,x] = find(I) ; % Get center of cricle C = [mean(x) mean(y)] ; % GEt raidus d = sqrt...

12日 前 | 1

| 採用済み

How to fill the area between contour line and upper bound.
Get your required curve/ line coordinates; form a closed polygon and use patch/ area.

12日 前 | 1

How to divide vector to matrix(same row and column)
To remove extra elements and convert to square matrix A = rand(82580526,1) ; l = length(A) ; % GEt the nearest perfect squ...

12日 前 | 0

| 採用済み

Plotting user inputs in a 2D plot
prompt = 'Enter any number that you like:'; %{ I only want the user to enter a maximum of 10 numbers. %} N = 10 ; figure...

12日 前 | 0

| 採用済み

2D plot of a matrix
Read about importdata to load the data into MATLAB. You can normalize an array x to [0,1] using: norm_x = (x-min(x))/(max(x)-...

13日 前 | 0

| 採用済み