Answered
Adjust count values in histogram
Use normalization (probability) to get what you want. temp = randsample(1:1:100, 1e4, true, [linspace(eps, 1-eps, 50), flip(lin...

4 years ago | 0

Answered
how to fix the error
for l=1:size(x,2) mu(l)=mean(x(:,l)); sigma(l)=std(x(:,l)); end X_norm=(x-mu)./sigma; Alternatively, no for-loop ...

4 years ago | 0

Answered
Need to convert a 2d matrix A to a heatmap with interpolation
fun = @(x) median(x(:)); A=nlfilter(A,[3 3],fun);%applies median filter in sliding 3x3 block

4 years ago | 0

| accepted

Answered
How to apply function with arguments to every cell in cell array
for k=1:length(baskets_xyz_h_ref) H(k)=dfaedit(baskets_xyz_h_ref{k},1,1,1); end

4 years ago | 1

| accepted

Answered
How can I rerun my code if my given statement is not followed by the user?
program_str ='a'; while ~ismember(program_str,'123'); program_str = input('Please select a program to optimize (1-Art, 2-Sc...

4 years ago | 0

Answered
Does it have a statement for replacing repeated multiple if and elseif statements?
a = 0:0.001:1; b = 0.03*sin(a); interval=0:.1*pi/180:pi/180; [~,~,idx]=histcounts(b,interval); b=b(idx~=0); for k=1:length...

4 years ago | 0

| accepted

Answered
How to remove cells that have the same value at the first row, first column as the previous cell, in a cell array?
There is only one repeated value in the example provided. You could round (1,1) values if you want them to be close but not exac...

4 years ago | 0

Answered
How do I detect if the input number is within a certain range?
f=floor(input_Num/2500); lower=f*2500; upper=(f+1)*2500;

4 years ago | 0

| accepted

Answered
Saving outptut of repeated calculations
a=3; b=1:180; c = a*b;%c is an array and has all the values

4 years ago | 0

Answered
hello, I'm supposed to check if the matrix is square if not, disp a message. when i used [n,m]=size(A), if n~=m, disp, it seems to work; if i use [n,n]=size(A),
Has to be two different variable; otherwise you are overriding the first assignment. You can use a single variable, such as: n=...

4 years ago | 0

Answered
Apply logical mask to every matrix in array
s=size(B); f=find(mask==1)+(0:s(3)-1).*(s(1)*s(2)); B(f)=nan;

4 years ago | 0

Answered
generate a vector with a condition of a vector
Hard to understand your question. You can generate a vector b anytime you want. If you want a cell array of all vector b's. for...

4 years ago | 0

Answered
how to calculate Weighted Averaging and distances
data=randi(100,100,3)-50;%sample data d=data(:,1:2)'; n=vecnorm(d-50); [a,idx]=sort(n); w=1./a(1:5); Z=sum(data(idx(1:5),3)...

4 years ago | 1

| accepted

Solved


Truncatable Prime
A truncatable prime is a leading digit is successively removed, then all resulting numbers are prime. Wiki When given a number...

4 years ago

Answered
Hello, is there a way to show the third dimension numbers of the chart in text?
Experiment with the text command until you find something you like [X,Y] = meshgrid(1:10,1:20); Z = sin(X) + cos(Y); surf(X,Y...

4 years ago | 0

| accepted

Answered
I need help creating an n x n matrix were can be changing
n=5; Matrix=zeros(n);

4 years ago | 0

| accepted

Answered
Solving Integrations with Simpson's Rule
You are doing numerical integral, no reason for symbolics. r0 = 3; f=@(r)4*pi*r.*(1-(r/r0)).^(1/6); n = 1280; a = 0; b = ...

4 years ago | 0

Answered
How do I find if the three arrays of unequal size have the same values?
f=find(ind1==ind2&ind2==ind3&ind1==ind3);

4 years ago | 0

Answered
Why wont unique function eliminate duplicate rows in timetable?
RadarTable = readtable('RADAR_DATA.xlsx'); RadarTimeTable = table2timetable(RadarTable); [~,idx]=unique(RadarTimeTable.time);%...

4 years ago | 1

Answered
Create a coordinate system (x, y, z) matrix
Xmin = 388363.3; Xmax = 390229.2; Ymin = 3310114; Ymax = 3311144; Zmin = 2027.96; Zmax = 2889.9; [X,Y,Z]=meshgrid(linspace...

4 years ago | 1

| accepted

Answered
Adjust the launching angle to produce the greatest range (i.e. maximum horizontal distance) but within 0° ≤ 𝜃଴ ≤ 90° in incremental of 0.1. Evaluate your results.
%% Question v Y = @(t,theta)y0 - 1/2*g*t.^2 + (v0*sind(theta))*t; X = @(t,theta)x0 + (v0*cosd(theta))*t; %% Question vi thet...

4 years ago | 0

Answered
update values ​​in a for loop except one
If you really want seconds... you might want to use clock and etime. I don't entirely understand what you want. For example some...

4 years ago | 0

Answered
Delete rows from a matrix using for loop
Forcing to use for-loop Matrix = [1,1 ; 1,2 ; 0,0 ; 0,0 ; 3,1 ; 0,0]; idx=[]; for k=1:size(Matrix,1) if all(Matrix(k,:)=...

4 years ago | 1

| accepted

Answered
Solving complex equation.
function Output = solveE(Input,guess) %Input is an array [U,mdot,H,z,y,sigmaY,sigmaZ,Cj] of all values except nan %for the var...

4 years ago | 0

| accepted

Answered
I am trying to use a button to open another app window but an error keeps popping up
Below shows a simple structure for what I think you want to do. function GUI() fig = uifigure; p = uipanel(fig,'Position',[20...

4 years ago | 0

Answered
How can I correct this error?
figure(1) for k = 1:24:480 nexttile vend = 1:24; bar(All_Horas(vend+k-1),All_PpH(vend+k-1)) xlabel('Ho...

4 years ago | 0

Answered
How to share variables between two nested functions?
If the functions are nested, then variables are carried over into all the nested functions and the variable names should turn gr...

4 years ago | 1

| accepted

Answered
delate a specific number in an array and the number that have the index corresponding to the this number in an other array
A=[0,0,3,4,5,6,7,8,9,0]; B=[10,9,8,7,6,5,4,3,2,1]; idx=A==0; A(idx)=[]; B(idx)=[];

4 years ago | 1

Answered
how to calculate the crowding distance of matrix ?
https://www.mathworks.com/matlabcentral/fileexchange/65809-on-the-calculation-of-crowding-distance

4 years ago | 0

| accepted

Answered
Find string of relative directory with regexp
txtrerf = regexp(txt,'myfile = ''[.]{2}\\{1}[.]{2}\\{1}pwd'';','match')

4 years ago | 0

| accepted

Load more