Respondida
Reduce a large XY array to a much smaller xy array where the x data is diluted to a much smaller vector and y values are the mean of the ones inbetween
I'll assume that "Y1 Y2 ... Yn" should be "Y0 Y1 ... Yn" and that "y1=mean(y0:y4); y2=mean(y5:y9); y3=mean(y10:y14); ..." should...

más de 3 años hace | 0

| aceptada

Respondida
How do I Vectorize the for loop containing if else ?
X1 = zeros(size(xH)); X2 = zeros(size(xH)); idx = xH > 0; X1(idx) = xH(idx); X2(idx) = xH(idx); COUNTco...

más de 3 años hace | 0

| aceptada

Respondida
Text File I/O Question
You don't need to go line-by-line and character-by-character, you can read the entire file at once and count the total number of...

más de 3 años hace | 0

| aceptada

Respondida
Calculate distance resulting from an histogram and a specific point
load matrix [N,C]=hist3([longitude, latitude],[50 50]); figure hist3([longitude, latitude],[50 50],'CDataMode','auto') v...

más de 3 años hace | 0

| aceptada

Respondida
To convert .continuous to .mat
Try this: % you'll need to clear the variable dir (and you might as well clear the % variable cell too) if this is a script an...

más de 3 años hace | 1

Respondida
What does the following code do?
This code prompts the user to input a sequence of matrices (input a scalar 0 to stop) and sorts the matrices according to the su...

más de 3 años hace | 0

| aceptada

Respondida
What does the following code do?
https://en.wikipedia.org/wiki/Newton%27s_method#Description

más de 3 años hace | 0

Respondida
simulation of lempel-ziv algorithm
It would be nice to know what the error message was. In any case, try using dec2bin (which is in base MATLAB) instead of de2bi ...

más de 3 años hace | 1

Respondida
Change Y axis values in a 2D chart
Use loglog instead of semilogx. (And make appropriate changes to ylim.)

más de 3 años hace | 1

| aceptada

Respondida
How to reduce its execution time?
u=[1 3 5 7 20 30 40 50]; b=u; Noise=5; [R,C]=size(b); P=C/2; M=2*C; %%%%%%%%%%%%%%%%%%%% % Swapping vector b %%%%%%%%...

más de 3 años hace | 0

| aceptada

Respondida
How to hold on values in ''Vector" with the continuity of the loop
t = 20:10:30; i = 900; a = t.' + i

más de 3 años hace | 0

| aceptada

Respondida
Countour plot based on velocity data
The x and y don't quite make a grid (a point is missing in the upper-left corner near (0,2)): xyz = readmatrix('velocity.txt');...

más de 3 años hace | 0

| aceptada

Respondida
connect nodes (coordinates of a matrix rx3) with a line
data = readmatrix('data.txt'); N = size(data,1); % d: distance (squared) from each point to each other point % (with t...

más de 3 años hace | 0

| aceptada

Respondida
Different colors for different text in a single textbox
str = { ... '\color{black}1st line of text', ... '\color{blue}2nd line of text', ... '\color{red}3rd line of text...

más de 3 años hace | 1

| aceptada

Respondida
I need help with my code
The function calculate_fluctuation_dissipation_factor takes two inputs, the first of which is a vector with (at least) two eleme...

más de 3 años hace | 0

Respondida
hello, I'm working on a program to encrypt using Caesar cipher, but the encryption I am receiving one letter only. For example, I input (car) but i receive only the letter (F).
lp is a 1-by-2 vector, only the first element of which is used in a colon expression (as you are using it, in defining your for ...

más de 3 años hace | 0

Respondida
Remove Rows that are entirely NaN
C = readcell('Inflation.csv') N_header_lines = 3; rows_to_delete = N_header_lines + find(all(cellfun(@ismissing,C(N_header_lin...

más de 3 años hace | 1

| aceptada

Respondida
Repeating arrow in plot
Store the annotations in a variable: annot = [ ... annotation("arrow", [0.2775 0.2988], [0.419 0.372]) annotation("ar...

más de 3 años hace | 0

Respondida
How to prevent legend from overlapping with x-axis
% making up some data: dates = [1980 2000 2020]; vdemg_out = rand(3,23); vdemr_out = rand(3,23); vdemi_out = rand(3,23); co...

más de 3 años hace | 1

| aceptada

Respondida
rotated plot gone wrong
You've got the outputs from freqz reversed: [w,rh]=freqz(h,1,64); The frequency response is first, and the angular frequencies...

más de 3 años hace | 1

Respondida
Question Regarding Callbacks and UI Control
"1. How could I make the string a dependent variable?" If you want the popupmenu to show the value of the "day" field for every...

más de 3 años hace | 0

Respondida
Adding means to separate boxplots in the same figure window?
When you call plot with one vector argument, that argument is treated as y and x is implicitly taken to be 1:numel(y). Since mea...

más de 3 años hace | 1

| aceptada

Respondida
How do you create a plot of a function using fplot?
f = @(t)5*t.^2; fplot(f)

más de 3 años hace | 0

Respondida
Use User Input as a Number to be Checked in If/Else Statement
"it seems that User Input is always a string" The value returned from the input function would be a character vector if you use...

más de 3 años hace | 1

| aceptada

Respondida
Surface Plot, 3D plot
X = [1.6 1.4 1.2 1 0.8]; % in terms of r Y = [0.3 0.5 0.7 1]; % in terms of r Z = [0.093 0.072 0.053 0.027 0.0005; ... ...

más de 3 años hace | 0

Respondida
Help with storing data in a 4-D double matrix
How about storing that data set as a table: t = readtable('new1.xlsx'); t = renamevars(t,t.Properties.VariableNames, ... ...

más de 3 años hace | 1

Respondida
Columns (with different column sizes) in plotlegend
I don't know of a way to do that by setting legend properties, but you can create "dummy" lines that don't appear in you plot bu...

más de 3 años hace | 0

| aceptada

Respondida
question regarding ploting a table as a surface
You can use the four-input syntax for surf (X,Y,Z,C), and set the Y to zeros. unzip('export.zip') data=readtable('export.txt')...

más de 3 años hace | 0

Respondida
matlab reads the.geo file
Here's one way: fid = fopen('rec.txt','r'); text = fread(fid,'*char').'; fclose(fid); data = regexp(text,'([\w ]+)\((\d+)\...

más de 3 años hace | 1

| aceptada

Respondida
how can we measure X value inside for loop ?
oldPosition = [-50; 50]; % Position A Velocity = 2 % Velocity of object angleoption = [-14.3239 -7.1620 -4.7746 1.4324 1.5915 ...

más de 3 años hace | 0

Cargar más