Community Profile # Chunru

Last seen: Today Active since 2013

Matlab user since 1990

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

Question regarding arranging matrix values
% a 22*1 matrix with end values zeros. x = rand(22, 1); x(end-5:end)=0; x % the last two zeros to occupy the first two row...

4 hours ago | 0

Color scale of scatter plot?
x = randn(100, 1); y = randn(100, 1); cmap = parula(512); cmap = cmap(1:360, :); % dark blue to green (360 colors) pos_...

21 hours ago | 0

How to get a line plot
x=[25 45]; y=[200 200] plot(x,y,Color='black') axis([20 50 100 400])

1 day ago | 0

| accepted

not displaying eval in command window
Try this: for i =1 : length (signal_names) ImportedSignals = genvarname(cell2mat(signal_names(i)), who); eval([Import...

1 day ago | 0

How can I find the intersection points between two curves and area between these curves?
% These are the Input parameters used w = 60; h = 350; T0 = 60; rho = 600; T= 3.175; N...

1 day ago | 0

| accepted

Calculate mahalanobis distance of matrix for each row
A = [110 -100 0; 100 -100 0; 10 0 0; 0 10 0; 0 -10 20; 0 -10 10; 0 0 10;-10 -10 -10; -10 0 0]; mean_row = mean(A,1); whos d =...

1 day ago | 0

| accepted

how to add two binary digits of 8bit size?
a = '01001011'; b = '00100011'; c = '00000000'; % Cosider a carry bit carry = 0; % loop through from last bit to first ...

1 day ago | 0

| accepted

select only one value every four (or different numbers) in an array
a = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] b = a(4:4:16)

1 day ago | 1

| accepted

How can I arrange a vector in ascending order
D = [3 6 7 2 -4 7 3 2 ] D1 = sort(D)

1 day ago | 0

| accepted

Calculate covariance matrix for simple example
format longg temp = [1 2 4 2 5; 100 300 200 600 100; 10 15 20 10 30]; res = cov(temp.')

1 day ago | 0

| accepted

How to start two plots with different origins.
p1 = [0 0]; % inital position for object 1 p2 = [2000 0]; v1 = [150 20]; % initial velocity for object 1 v2 = [-80 30...

1 day ago | 1

| accepted

url = "https://www.mathworks.com/help/pdf_doc/matlab/learn_matlab.pdf"; tic urlwrite (url, 'learn_matlab.pdf'); toc dir

1 day ago | 0

How can i use string values saved in a cell array as variable names in a for loop.
You can put the result in a struct with field names corresponding to your Dist_type load Test_Data.mat Dist_type = {'Kernel', ...

1 day ago | 0

| accepted

To usa counties and state mape and shade with different color
warning off states = shaperead( 'usastatehi.shp'); % MATALB comes with usa states map .shp file You can download the county l...

1 day ago | 0

| accepted

Generating Geometry Patterns at Scale
What does flattenong the plot of the red polygon mean? xCenter = 10; yCenter = 10; % Modification to the FAQ is the next two ...

1 day ago | 0

how do i find the min value using for loop?
syms x smin = inf; % initialize smin for yr = linspace(0,1,10) f = sin(x); fL = [0 pi]; iL = [0 pi]; ...

2 days ago | 0

| accepted

Converting a 2d array into a 3d array
"it is taking lot of time" for what size of array? m=200; n=100; Z_int = rand(m, n); Z = nan(m,m,n); tic for i = 1 : size(...

2 days ago | 0

How Can I determine minimum value in a double array?
vect =[ 2.6660 2.2852 10.0000 3.2617 10.0000 10.0000 9.8532]; [vmin, idx] = min(vect)

2 days ago | 0

I want to colour the area between red line and black line below the intersection point. how am i going to do it?
c=[3,5]; A=[1,2;1,1;0,1]; b=[2000;1500;600]; y1=0:1:max(b); x21=(b(1)-A(1,1)*y1)./A(1,2); x22=(b(2)-A(2,1)*y1)./A(2,2); x2...

2 days ago | 1

How to vectorize the function?
fc=1e+8; % carrier fm=1e+3; % modulate fd=7.5e+4; % frequency deviation r=0.25; t0=0.0005; % reflection and delay w0=2*pi...

2 days ago | 1

How do I move an item in an array to the end of that array?
T = [1 5 77 10 15 20 25 33]; T1 = sort(T) % Method 1 T2 = T([1:2 4:end 3]) % Method2

2 days ago | 0

How to set x axis in a plot?
subplot(6,1,1:5); imagesc([1 8], [14, 22], randi(100,100)); subplot(8,1,8); imagesc([1 8], 1, [1 2 2 2 2 2 2 3 3]); set(gca, ...

2 days ago | 0

| accepted

How to create a moving average filter to a specific signal
x = readmatrix("2013.txt"); n = 7; % filter order y = filter(ones(n, 1)/n, 1, x); plot(x); hold on; plot(y); legend('Or...

2 days ago | 0

use matlab code to draw the joint PMF and CDF
[x, y] = meshgrid([0 1], [0 1]) z = [0.25 0.5; 0.125 0.125]'; stem3(x, y, z) xlabel('x'); ylabel('y'); zlabel('p')

2 days ago | 0

Extract Tables from within a cell
s = load("Tables") % i-th tables i = 1; t = s.Tables{i}

3 days ago | 0

| accepted

Populating a vector between upper and lower bound?
e0 = 0; % Initial strain values e_max = 4; % Max strain values inc = 1; % +ve increase, -ve decrease e_t ...

3 days ago | 0

| accepted

same number in the vector
h=[0.12;0.1;0.1;0.04;0.04;0.04;0.1;0.1;0.1;0.06;0.1] hu = unique(h); idx = sum(h -hu' == 0) > 1; hrep = hu(idx)

3 days ago | 0

| accepted

n = 300; R = 350; x0 = 50; % Center of the circle in the x direction. y0 = 90; % Center of the circle in the y direction. an...

3 days ago | 0