Community Profile # Chunru

Last seen: 1 day ago Active since 2013

Matlab user since 1990

#### Statistics

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

View by

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

How can I add recession bars to a time series plot?

2 days ago | 0

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

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

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

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

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

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

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

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

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

How to segment a curve into linear and nonlinear pieces

2 months ago | 0

| accepted

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

How can to compute the following case?

2 months ago | 0

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

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

2 months ago | 1

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

create empty row inside a vector

2 months ago | 0

| accepted

How to interpolate to fill zeros in two-dimensional data

2 months ago | 0

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

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

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

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

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

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

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

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

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