Community Profile

photo

Chunru


Last seen: 1 day ago Active since 2013

Matlab user since 1990

Statistics

All
  • Treasure Hunt Participant
  • MATLAB Central Treasure Hunt Finisher
  • 12 Month Streak
  • Guiding Light
  • Number Manipulation I Master
  • Indexing I Master
  • Revival Level 2
  • Knowledgeable Level 5
  • Commenter
  • Sequences And Series II Master
  • Speed Demon
  • Creator

View badges

Content Feed

View by

Answered
Not enough inputs with input parser
F = @(x) x.^2.*sin(x)-0.2.*x.^3+3.*x.^2+x-4-0.005.*x.^4; nx = newtonsMethod(F,6.5) function x = newtonsMethod(func,guess,tol,d...

1 day ago | 0

Answered
How can I add recession bars to a time series plot?
data = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1488862/example_data.xlsx'); y = data.var3; x=...

2 days ago | 0

Answered
Quiver. Make wind scale of 1m/s inside plot
[x, y] = meshgrid(-2:.2:2); z = x.*exp(-x.^2-y.^2); [dx, dy] = gradient(z, 0.2); sc = 'off'; % scale quiver(x,y,dx,dy...

2 days ago | 0

Answered
How to plot a bar graph for individual values?
x = 1:2; y = 0:0.1:0.5; z = [0.725, 0.654, 0.543, 0.812, 0.698, 0.456; 0.628, 0.652, 0.783, 0.682, 0.758, 0.765]; b = b...

2 days ago | 0

| accepted

Answered
How to make Matlab give different answers for different text inputs of different lengths
A = input('Ask me anything: ','s'); if strcmpi(A, 'Yes') % compare string (case insensitive) disp('Yes') else disp...

1 month ago | 0

Answered
How to Pre-allocate a 4D photo array
%Photos = zeros(1920, 1080, 3, 1800, 'uint8'); Photos = zeros(100, 50, 3, 10, 'uint8'); whos

1 month ago | 0

Answered
How to check the freqeuncy response of a boxcar filter?
clear all; clc; fs =2000; fc =20/(fs/2); N = 1/fc; h = boxcar(N); % 1/N = fc h = h/sum(h); bcoeff = h; acoeff = 1; ...

1 month ago | 0

Answered
Possibilities of using for end loop in code
In MATLAB, you can do it without loop (preferred approach): theta = [0 10 20 30 50]'; r = [9 8 7 6 3]'; y = [...

2 months ago | 0

Answered
Running MATLAB on virtual machine for more memory?
I am running some very time-consuming MATLAB scripts on my laptop and it keeps on running out of memory. ==> You may want to c...

2 months ago | 0

Answered
How to extract coefficients of custom variables in symbolic expression in MATLAB?
Let iB=1, jB=0 and kB=0. Then compute omegaB.

2 months ago | 0

Answered
find numbers in a string
s = 'E_Field (Farfield) (Cartesian) (-0 -173.648 983.808)(Abs) (cosim Tran1).txt'; s1 = 'E_Field (Farfield) (Cartesian) (-0 -1...

2 months ago | 0

Answered
How to segment a curve into linear and nonlinear pieces
load(websave("DatasetXY.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1437433/DatasetXY.mat")); whos [...

2 months ago | 0

| accepted

Answered
Summing up subsequent rows if equal
A = [ 2 3 5 3 4 5 2 3 5 3 4 5 5 6 6 2 3 5 5 6 6 3 4 5 ]; ...

2 months ago | 0

Answered
How can to compute the following case?
load(websave("D.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1436693/D.mat")); for i=1:size(D, 1) ...

2 months ago | 0

Answered
how to smoothen this calor bar image
n = 17; x =0:n-1; y=0:n-1; a = randn(n, n); subplot(121); imagesc(x, y, a); xlim([0 n-1]); ylim([0 n-1]); subplot(122); ...

2 months ago | 0

Answered
fsolve no solution found results
doc fsolve for more details. [x, fval, exitflag, output] = fsolve() % check out exitflag and output

2 months ago | 1

Answered
Is it possible to go down a row and still run the code?
Use ... at the end of line for line continuation analysisdata(1:17,1)={'Image name', 'Cell mask number', ... 'Total masked...

2 months ago | 1

Answered
create empty row inside a vector
load(websave("value_GS_test.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1436593/value_GS_test.mat")); ...

2 months ago | 0

| accepted

Answered
How to interpolate to fill zeros in two-dimensional data
load(websave("power.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1436568/power.mat")) whos L2 = 200;...

2 months ago | 0

Answered
How do I store x-y coordinate values in a 2 Dimension array (n x n) with its x-y position ?
xy = [27 104; 35 100; 47 102; 25 110; 35 114; 47 109; 50 123]; A = zeros(7, 7); ...

2 months ago | 0

| accepted

Answered
To use multiple xtick methods in MATLAB plot
x1 = [1 2 3 4 5]; x2 = [0.1 0.2 0.3 0.4 0.5]; x3 = [10 20 30 40 50]; y = rand(3, 5); % make data different %% Use mu...

2 months ago | 2

| accepted

Answered
How to iterate and access over map key values
mp = dictionary(["a1", "a2", "a3"], {1, [2 3], "str"}) k = keys(mp); v = values(mp) for i = 1:length(v) disp(v(i)); end...

2 months ago | 0

Answered
How to find intersections in contour plot?
rho = 4420; %kg/m^3 Cp = 550; %J/kg?K T0 = 303.15; %K A = 0.5; %[Absorbtivity] k = ...

2 months ago | 2

| accepted

Answered
acoustic emission cumulative energy
% signal amp = sqrt(2); f0 = 100; fs = 1000; % simulated signal (replace it with audio file) x = amp*sin(2*pi*f0*(0:1/fs:5)...

2 months ago | 0

Answered
Calculate and plot a cdf or pdf functions for 3D matrices?
% Sample data with normal distribution nlat=2; nlon=3; nyear=150; A=randn(nlat, nlon, nyear); edges = (-3:.3:3); x = (edges(...

3 months ago | 0

Answered
How to plot a surface not sampled on a gid/mesh
% generate a surface X = rand([1000 1])*2*pi; Y = rand([1000 1])*2*pi; Z = sin(X) + cos(Y); % trianglation tri = delauna...

3 months ago | 0

| accepted

Answered
How to make a structure with numerous(>200) fields with loop?
n= 5; Data = randi([1 10], [5 1]) for i = 1:n S.("Pt_"+i) = Data(i); end S

3 months ago | 1

| accepted

Answered
Trouble with Implementing Moving Average Filter in MATLAB
%Input data inputData = [1, 2, 3, 4, 5, 6, 7, 8, 9]; windowSize = 3; % use matlab function filteredData = movmean(input...

3 months ago | 0

Answered
Finding Indices of Zeroes Following Non-Zero Elements in MATLAB
x = [0,0,0,0,0,0,1,3,5,2,4,6,7,8,3,0,0,0,0,4,1,10,22,11,22,44,44,12,0,0,0,0]; x1 = x>0 % clipped x i1 = find(diff(x1)>0) i2 ...

3 months ago | 0

Answered
How to read all variables in netcdf file
fn = "abc.nc" ni = ncinfo(fn); for i=1:length(ni.Variables) vn = ni.Variables(i).Name; x.(vn) = ncread(fn, vn); %...

3 months ago | 0

| accepted

Load more