Réponse apportée
convert real numbers to img form
a = 8 b = a*1i % method 1 c = complex(0, a) % method 2

plus de 4 ans il y a | 1

Réponse apportée
Restricting time on graph with given time
a = datetime(2021, 1, 1:365); b = rand(size(a)); plot(a, b) idx = find(month(a)==1); xlim([a(idx(1)), a(idx(end))])

plus de 4 ans il y a | 1

Réponse apportée
How to add a cylinder to a scattered plot
% A = load ('Data.txt'); A = 0.05*rand(8, 4) x = A (:,1 ) ; y = A (:,2 ) ; z = A (:,3 ) ; Amplitude = A (:,4) ; scatter3 ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Calculating mean square difference (MSD) of two matrices
Im = [0 252 204; 221 135 58; 156 122 127] Im2 = [169 250 237; 186 196 148; 227 148 4] F2 = sum(sum(mean(Im...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
how to save variable as txt in a specified location with variable value appearing in the file name
a=1; % amplitude du faisceau gaussien x=linspace(-50,50,100); dx=50/2.355; % widthn f=a*exp(-0.5*(x./dx).^2); [pks, locs, wi...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Quiver plot when axes scale are too different result in very ugly plots
load("quiverPlotVariables.mat") whos % You need to scale the vdot and/or psidot so that they are representing % the true orie...

plus de 4 ans il y a | 0

Réponse apportée
How can delete the variable part?
s = load("T9S11.mat"); x = s.T9S11 x(2:2:end,:)=[]

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
repmat usage for cellarray
data_string = reshape(char(32:127), 3, []) % some characters32 x 3 char aray cell_array=repmat({data_string},1,3) cell_array{...

plus de 4 ans il y a | 0

Réponse apportée
Append vector into zero matrix
v = zeros(5, 3); x = randn(3,1); n = numel(x); for i=1:size(v, 2) v(i-1+(1:n), i) = x; end v

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
benefits of using "Structs" over "Cells" in MATLAB/Octave?
See the documentation: https://www.mathworks.com/help/matlab/matlab_prog/cell-vs-struct-arrays.html Struct use field name to ac...

plus de 4 ans il y a | 0

Réponse apportée
Marker edges, line width and legend
xx=linspace(0,12); figure(1) plot(xx,sin(xx),'LineStyle','-','LineWidth',2,... 'Color','red', 'HandleVisibility','off');...

plus de 4 ans il y a | 0

Réponse apportée
Modify a text file
% Assume that your text file is data.txt s = fileread("data.txt"); s = strrep(s, '4.500000e-001', '0.8000'); fid = fopen('d...

plus de 4 ans il y a | 0

Réponse apportée
nanstd use in matlab
You are using default normalization "[]", which normalised the std by (N-1). If you want to get 0.0129, you need to change [] i...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
What's wrong in the code? I cant generate the same graph as the question required.
x = -5:0.1:5; y = sin(x.^2).*exp(cos(x)); plot(x,y)

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
I have problem with while loop.
Make the following change: %while (szb(1,1)~=szA(1,1) && szb(1,2)~=1) while (szb(1,1)~=szA(1,1) || szb(1,2)~=1)

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
Solution found by matlab is too big to use
There are two solution of the equation. You need to select one. The modified code choose the 1st solution. You can always to ...

plus de 4 ans il y a | 0

Réponse apportée
How to create one common colorbar and colorscale for subplots
You need to add in the following inside the loop for each subplot: caxis([0 60]); % adjust the number 60 or find the value fr...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Trying to do product of eigenvalues collected from a matrix
First the difference "e" (as below) will not be perfectly 0 and it is subjected to computational accuracy. Second, the eigen va...

plus de 4 ans il y a | 0

Réponse apportée
Why does my function return a single value instead of an array? I need it to return an array so I can plot it.
Use ./ instead of / for array operation. [Note that there is division by 0 in your equation] Dn2 = @(n) (1-exp(-1j*pi*n/2))./(...

plus de 4 ans il y a | 0

Réponse apportée
Using textscan() to get data from a TXT file, but all cells are NaN
Your format specifier is not correct. s=["1,2,3,4" "2,4,5,7"] V = textscan(s(1),'%f %f %f %f','Delimiter',',') V = tex...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Reshape a row vector and convert it to a cell array
x = [1:10, 101:110, 11:20, 111:120]; x = reshape(x, [20, 2])'; C = mat2cell(x, [1 1], [10 10])'

plus de 4 ans il y a | 1

Réponse apportée
How to fix this error in interp1?
R = 1e3; % resistor value [Ohms] C = 1e-6; % Capacitor value [Farads] H = tf([R*C,0], [R*C,1]); % plot a bode plot (3dB frequ...

plus de 4 ans il y a | 1

Réponse apportée
Precision number throughout scripts and functions.
You can use "format" command to specify a format such as short, long, shortE, shortG. "doc format" for more information. If yo...

plus de 4 ans il y a | 0

Réponse apportée
Rotating 3D data
clc; clear all; close all; x = linspace(-10,10,49); y = linspace(-10,10,44); [X,Y] = meshgrid(x,-y); Z = zeros(44,49); Z = ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
sum of series with vectors
Rhoo = 300e-5; Caplambda = 1e-4; Beta = [24 123 117 262 108 45]; lambda = [0.0127 0.031 0.116 0.3106 1.4006 3.876]; t = [0:1...

plus de 4 ans il y a | 0

Réponse apportée
Derive base 10 logarithm from base 2 log output
The formula is: For any given base b, you need to compute a constant .

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
Can I use a variable name to make logical comparison?
months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Decembe...

plus de 4 ans il y a | 1

Réponse apportée
how to calculate row values based on the previous row value of a column?
a= [1,2,3,4,5,6,7,8,9,10]; b = 100; % initial value for i=1:numel(a) b= (a(i)*b)+b; fprintf("i=%2d b=%d\n", ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Finding largest data from table
X1=[9 6 9 0;3 2 7 0]; X2=[0 2;4 0]; X3=[3 1 2; 8 9 7]; X4 = X1; X=table(X1,X2,X3,X4) len = table2array(varfun(@(x) size(x...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Plotting an array on both x and y axis and different formulas, check description
i = 0:0.1:7; j = 7:0.1:10; yi = 2*i; yj = 3*j; plot(i, yi); hold on plot(j, yj)

plus de 4 ans il y a | 0

Charger plus