Community Profile

photo

Chunru


Last seen: Today Active since 2013

Matlab user since 1990

Statistics

All
  • MATLAB Central Treasure Hunt Finisher
  • 6 Month Streak
  • Pro
  • Number Manipulation I Master
  • Indexing I Master
  • Knowledgeable Level 4
  • Revival Level 1
  • Commenter
  • Sequences And Series II Master
  • Speed Demon
  • Creator
  • Sequences And Series I Master

View badges

Content Feed

View by

Answered
Find Command not working.
use abs(difference) to comapare the float numbers. T=[NaN 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]; a=0.6; V=find(abs(T-a)<1e-10)...

1 day ago | 0

Answered
For rows and 2 columns, containing xOy coordinates of the point. Look for the two points with the furthest distance and return the row index of those two points.
n = 8; xy = rand(n, 2); d = pdist(xy); D = squareform(d) [~, idx]= max(D(:)); [i, j] = ind2sub([n n], idx)

2 days ago | 0

Answered
I would like to create a handle function by for loop in matlab, but it does not work. I will be thankful if some body help me.
a=[1 2 3]; b=[4 5 6] n=length(a); for i=1:n s{i}=@(x) a(i)*x-b(i)*x; end s{1}(3)

2 days ago | 1

Answered
each columun of a 2D matrix multiply with a 3D array
A=rand(20,30); B=rand(6,6,20); c=0; for j=1:30 d=0; for k=1:20 d=d+A(k,j)*B(:,:,k); end c=c+d;...

2 days ago | 0

Answered
Feature Input layer error MATLAB 2021a
featureInputLayer is Introduced in R2020b. Try: which featureInputLayer numFeatures = 21; numClasses = 3; layers = [ ...

2 days ago | 0

Answered
Can I get help with loops and char function?
n = 3; %input('Enter # of derivatives to compute (1-7): '); %prompts a value input syms x E = 2*x^9 + 3*x^6 - 8*x^2 for i=1:n...

2 days ago | 0

Answered
Change char to cell
msg{1} =['abc12';'def34'] msgc = cellstr(msg{1})

3 days ago | 0

Answered
How can I add sinusoidal signal and fft?
fs = 1000; f = [40 80 100 250]; % freq a = [1 2 3 1]; % amp p = randn(1,4)*2*pi; % phase t = (0...

4 days ago | 0

| accepted

Answered
How to view image from .MAT file
x = load("1.mat"); x.cjdata figure(1); imagesc(x.cjdata.image); axis image saveas(gcf, 'a.jpg'); figure(2); imagesc(x.cjdata...

4 days ago | 0

| accepted

Answered
Can you exclude dates in date range using xlim?
dn = now + [0:.5:48]/24; y = randn(size(dn)); subplot(311) plot(dn, y) datetick('x') subplot(312) idx = hour(dn)>7 &...

4 days ago | 0

| accepted

Answered
Modulus Arithmetic Function Not Working
715^17 is too big. You can use symbolic computation: r=rem(sym(715)^17,2773)

4 days ago | 0

| accepted

Answered
Storage results in an array
% Without loop x=[2,3,4,5,6]; y=x; y(x>4)=x(x>4).^2; y(x<=4)=x(x<=4)+2 % With loop x = [2,3,4,5,6]; y = zeros(size(x)); ...

4 days ago | 0

Answered
programme matlab pour calculer et trace l'histogramme d'une image
I = imread('pout.tif'); imhist(I)

4 days ago | 0

Answered
Matrix Multiplication for each row
n = 5; %100000 A = randn(n, 2); B = [4 2; 2 3]; if n<100 d1 = diag(A*B*A') end d2 = sum(A.*(A*B'), 2)

4 days ago | 0

| accepted

Answered
Plotting pie charts over GraphPlot
Here is the updated answer. We play with the properties of pie_chart this time. clf s = [1 1 1 1 2 2 3 4 4 5 6]; t = [2 3 4 ...

6 days ago | 1

| accepted

Answered
How to change the position of labels on plot?
Add a number to z in "text" command. data = [1,0,3.8*10^8 2,1,4.2*10^7 3,2,1.5*10^7 4,3,7.8*10^7] ; x = data(:,1) ; y = ...

6 days ago | 0

| accepted

Answered
Plotting over a Range of Values
Use the array operator .* ./ .^2 for arrays. altitude = 150:1:1000; mu_earth = 3.986*10^5; %km3/s2 orbital_speed = sqrt(mu_ea...

6 days ago | 0

| accepted

Answered
Fitnet: Out of memory error solved by transposing?
When you use "my_ANN = train (net_set, input,output)", your network will have a input/output size of 49736, which results in man...

6 days ago | 1

| accepted

Answered
How can I only select table data from a text file.
a=readmatrix('G2_A.txt', 'NumHeaderLines',8)

8 days ago | 0

Answered
Removing commas between columns in text data
test = {'Sometimes, ,, I, use, commas, .' 'I, like, writing, ,, I, like, reading'}; test = regexprep(test, ',\s', ' ') ...

9 days ago | 0

Answered
Show limited digits numbers.
You can use fprintf with format specifier to format the print out. "doc fprintf". A=2.54357766; fprintf('%.6f\n', A);

9 days ago | 0

Answered
Change string words to number in table
% Assume the column has the data x.omst=["Clouds"; "Rain"; "Clear"] % You can use the categorical data x.omst = categorical(x...

10 days ago | 0

| accepted

Answered
Deleting unnecessary values in numerical array
% Assume that your data in second column is sorted. x = [ 1420 1 1410 1 1400 1 1390 0.9 1380 0.8 1370 0.7 1300 0 1290 0...

10 days ago | 0

| accepted

Answered
99x99 matrix
% For time comparison: n = 1000; timeit(@() bidiag1(n)) timeit(@() bidiag2(n)) timeit(@() bidiag3(n)) function bidiag1(n)...

10 days ago | 0

Answered
99x99 matrix
n = 9; %99 A = eye(n); A(n:n-1:n*n-1) = 1; % anti-diagonal A

10 days ago | 0

Answered
How can I generate a square lattice undirected graph?
n = 10; A = delsq(numgrid('S',n+2)); G = graph(A,'omitselfloops'); h = plot(G); h.XData = floor((0:99)/10); h.YData = rem((...

10 days ago | 0

| accepted

Answered
add an line for the coasts of the continents used for the geodensityplot in the mapping toolbox
mapping toolbox has the convention of lat-lon coordinates rather than lon-lat. try the following in your code: lon = linspace(...

10 days ago | 0

| accepted

Answered
How can I add more colors to semilogy?
plot(rand(30,20)+(1:20)); % plot 20 lines legend % The following line will change the default ColorOrder (7 colors) % change...

12 days ago | 0

Answered
how to change the front size and the inclination in a bar graph
h = gca; h.XTickLabelRotation = 0; % not recommended for long string h.TickLabelInterpreter = 'none';

13 days ago | 0

Answered
How do i remove conj from differention?
clear all syms x v s a y z r t real syms x(t) y(t) assumeAlso([y(t),x(t)],'real') A=[x, diff(y(t),t), s; y, z, r; s x(...

14 days ago | 0

| accepted

Load more