Answered
Inserting doubles into the field of a struct
load(websave("Updating.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1129165/Updating.mat")) load(websa...

3 years ago | 1

| accepted

Answered
Amplitude Spectrum of a function
If you are studying the effect of sampling frequency, you may want to fix the signal duration, for example . In this case, you ...

3 years ago | 0

Answered
How do I plot a Bayesian network graph in my way?
DAG = [0 0 1 0 1 1 0; 0 0 1 1 0 0 1; 0 0 0 1 1 0 0 ; 0 0 0 0 0 1 0; 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 ; 0 0 0 0 1 1 0], %assume th...

3 years ago | 1

| accepted

Answered
How do I get Os at drag=0 and Xs for drag=1 on my plot? (code and plot in the description) (plot markers)
hold on idx = drag==1; plot3(h(idx), s(idx), drag(idx), 'r^') plot3(h(~idx), s(~idx), drag(~idx), 'bo')

3 years ago | 0

Answered
vectorized code is more time consuming than a simple for loop
With the improvement of the execution engine and jit, newer verions of matlab improve the for-loop performance. Very often, the...

3 years ago | 0

Answered
Hello everyone. I have a file .data and I need to convert it to an array. How can this be done?
websave("iris.dat", "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data") x = readtable("iris.dat")

3 years ago | 1

Answered
Opening multi txt file with chosen directory location
mkdir TestDir % This is for demonstration only. websave("TestDir/10001.txt", "https://www.mathworks.com/matlabcentral/answers/...

3 years ago | 0

| accepted

Answered
How to correctly plot the PSD of segments of a signal?
% r1 = r(1:U); U = 8192; r1 = randn(U, 1) + 1i*randn(U,1); % complex baseband signal fs = 10000; fc = 2000; nfft = 1024...

3 years ago | 0

Answered
How to turn a dataset into a matrix
doc readmatrix doc readtable

3 years ago | 0

Answered
using a variable to call another variable
T1 = zeros(k, 1); % use array instead of T1_, T1_2, ... omega1 = zeros(k, 1); for n = 1:k temp = readmatrix(...

3 years ago | 0

| accepted

Answered
How can I close the currently open directory in matlab
% You change directory rather than close directory % We make two directories here for example mkdir dir1/dir1_1 mkdir dir2 ...

3 years ago | 0

Answered
How can I resize a mat file that contains images
V =rand(40, 40, 40); q = (0:59)/59*39+1; qqq = meshgrid(q, q, q); % 3d interpolation V1 = interp3(V, qqq, qqq, qqq); whos ...

3 years ago | 0

Answered
Read csv with quotes and numbers
type data.txt fid=fopen("data.txt", "r") a=fscanf(fid, '%d,"%d,%d,%c"', [4 inf])' fclose(fid)

3 years ago | 1

| accepted

Answered
MacLaurin Series Demonstration - Unexpected Result?
There was error in computing Y, which has been corrected. You should use loops/array operation instead of hard coding When X i...

3 years ago | 0

| accepted

Answered
Decimate every row in a matrix
% assume that decimate is used for downsampling a = randn(100, 26); % time is along the column [ns, nch] = size(a); r...

3 years ago | 0

Answered
Plot specific cells of cell array
A{1,1}=[]; A{1,2}=[]; A{2,1}=rand(1, 30); A{2,2}=rand(1,30); A{3,1}=[]; A{3,2}=[]; for i=1:numel(A) if ~isempty(A{i})...

3 years ago | 0

| accepted

Answered
Access variables with naming in workspace
First of all, try to change the program that produces data1 to data100 by using multidimensional array or cell array if possible...

3 years ago | 0

Answered
Number generator for 0.00006 to 30 range
% Kd=unifrnd(0.000069,30); logminmax = log10([0.000069,30]); for i=1:20 kdlog = unifrnd(logminmax(1), logminmax(2)); ...

3 years ago | 0

Answered
How to optimize condition code?
for cnt=1:10 if (cnt == 1 && a(cnt) == 0) || (cnt>1 && (a(cnt) == 0 || a(cnt-1) == 1)) statement A; else statement B; ...

3 years ago | 0

| accepted

Answered
To fill the value from the variable until the Num counts
time = [5.10616303,9.433357995,13.76055296,18.08774792,23.19391095,29.37822416,35.56253737,40.66870040]; T = length(time); num...

3 years ago | 0

| accepted

Answered
how to design a single cycle square wave?
% For single square pulse, you can specify: % pulse width: pw % simulation time: T f0=2.25e6; pw = 1/f0/2; fs=100e6...

3 years ago | 0

| accepted

Answered
How to plot the 10th and 90th percentiles of the predictions?
load(websave("conf_int.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1121675/conf_int.mat")) whos P = ...

3 years ago | 0

Answered
Error using vertcat ; Dimensions of arrays being concatenated are not consistent.
beta = 0.1; delta = 0.05; max_time = 100; S0 = 0.95; I0 = 0.05; R0 = 0.0; dXdt = @(t,X) [ -beta*X(1)*X(2); beta*X(1)*X(2)-...

3 years ago | 1

Answered
How to label the longitudinal axis with positive and negative values ?
load coastlines geoplot(coastlat,coastlon,"b", 'LineWidth' ,1) geobasemap topographi geolimits([-30 30],[130 -130]) box on ...

3 years ago | 0

| accepted

Answered
I want to know how to writ code to net1 = train(net,input,z) but z is double(complex)??
net1 = train(net,input,[real(z) imag(z)])

3 years ago | 0

Answered
How to plot discontinous function f(x,y)
syms x y z f(x, y) = x-.8193318913*sin(x)*cos(x)/(cos(x)^2+sinh(y)^2)-(0.2931044702e-2*(0.7500000000e-3*x^2-0.7500000000e-3*y^2...

3 years ago | 0

Answered
Convert a integer matrix to a red and blue colored matrix
A = [-1 1 1; 1 -1 1; -1 -1 -1] imagesc(A); % select a colormap cmap = hsv(8); % based on hsv cmap = cmap(...

3 years ago | 0

| accepted

Answered
extract the last value from each cell in array?
max_iterations = 500; max_iterations = 500; xs = 1 : max_iterations; websave('transRewards_40_0.1_2.csv', 'https://www.mathwo...

3 years ago | 0

Answered
make mx1 size array with m number of inputs
%zai=[ 0.0 0.4 0.2 0.3 0.4]; %I want to change the size of this array based on inputting the size value and I will give the n n...

3 years ago | 0

Answered
Applying free space path loss to a SNR formula
distance=0.02; %distance between ue and eNb in km F= 10; %frequency in MHz No= -174; %noise in dBm/Hz PL = 20*lo...

3 years ago | 0

Load more