Respondida
How to convert interval from to scalar. The problem is:
Do you mean a loop over a number of interals? k = -0.5:.05:-0.1; %(interval) for i=1:length(k) prob.Objective = k(i) * f...

casi 5 años hace | 0

Respondida
how to convert vector char to matrix char ?
You don't need to do anything. X is already an array. X = 'ABCDEFGHIJKLMNOPQRSTWXYZ' X(2) X(1,2)

casi 5 años hace | 2

| aceptada

Respondida
How can I write a magic(5) matrix to a text file with special delimiters?
x = magic(5); fid = fopen('test.txt', 'w'); fprintf(fid, '%f\n', x); % try different format here fclose(fid) type('test.t...

casi 5 años hace | 1

| aceptada

Respondida
with a function y(x) how can i plot 2y(3-x)
syms x y = piecewise(x<0, 0.1*x^2, x>0, .5*x) g = subs(y, x, 2*x) fplot(g)

casi 5 años hace | 1

| aceptada

Respondida
Does "insertText" not support Chinese fonts? How do I add Chinese fonts to my images?
I = imread('peppers.png'); % Find out the Chinese Fonts installed in your system % listTrueTypeFonts I=insertText(I,...

casi 5 años hace | 0

| aceptada

Respondida
How do I only display the rows for when column 1 is > 0 when I have 4 columns with corresponding data to the first column
a = [-0.00502163330810033 -0.00535602354270113 -0.00175905055456396 -0.00195122013126169 0.0191518806112861 0.02329682192...

casi 5 años hace | 0

Respondida
Bubble sort error line 1
You code can run. if you use "input", key in the following "[1 3 2 5 2]" without quotes. %cases = input('Enter cases with [ ] ...

casi 5 años hace | 0

| aceptada

Respondida
How to plot a piecewise function on Matlab?
You can try the another function. syms f(x) f(x) = piecewise(x<=5, 1-sqrt(5-x), 5<x<7, 1, x>=7, 1-sqrt((x-7)/3) ) fplot(f, [0...

casi 5 años hace | 0

| aceptada

Respondida
"Fixed point" binary sequence for values between 0 and 1
% Given x in [0, 1) x = 0.5234567 % Number of bits in binary (bits after .) n = 32; b = dec2bin(x*2.^n, n); b=['0.' b]

casi 5 años hace | 0

Respondida
finding the max number?
x=[1 3 5 7] y=x.^2+5 % use .^ here [~, idx] = max(y) % idx the where y is the max x(idx) ...

casi 5 años hace | 1

Respondida
I need to find the length of an array for values > 0
a = [1 2 0 3 -1 2 0]; n = sum(a~=0)

casi 5 años hace | 0

| aceptada

Respondida
Partial pivoting row swapping
a=[1 4 3 5;2 0 2 6;1 1 0 5;1 2 3 4]; b=[5;6;7;10] ab=[a b] for i=1:size(ab, 1)-1 % pivoting [~, imax] = max(abs(ab(...

casi 5 años hace | 0

| aceptada

Respondida
Right align text in subtitle
figure; plot(randn(10,1)) t = title({['\fontsize{14}','First line']; ... ' '}, ... 'FontWeight','Normal'); axPo...

casi 5 años hace | 0

| aceptada

Respondida
m=1:24*(T^-1);
T = 2 % Given a number T T^-1 % T^-1 is 1/T m=1:24*(T^-1) % m is from 1 to 24/T=12 with default step of...

casi 5 años hace | 0

| aceptada

Respondida
What is the easiest way to remove a vector from a matrix?
a = magic(4); a = [a; a(1, :); a]; % 1st 5th and 6th rows are the same a y = a(1, :); % the vector inpu...

casi 5 años hace | 0

Respondida
Issues with contour plot of f(x, y) = x/y.
You just need to remove the level=0 which result in x=0 (not y=0) being plotted. x = -5:.1:5; y = -5:.1:5; [X,Y] = meshgrid(x...

casi 5 años hace | 0

| aceptada

Respondida
reading 10 values randomly from txt file
% Generate the text file n = 200; % 5000 x = randi(100, n,1); fout = fopen('test.tx', 'wt'); fprintf(fout, '%f\n', x)...

casi 5 años hace | 1

Respondida
Can someone please help! I cannot plot this graph.
x=[-0.1:.001:0.1]+eps; % your original x has only 1 point without the step. % In addition, x can be zeros abd the y is not d...

casi 5 años hace | 0

| aceptada

Respondida
Adding sequence of data
a=[1 2 3 4 5 6]'; c = sum(reshape(a, 2, []))

casi 5 años hace | 0

| aceptada

Respondida
Plot date labels in x-axis
xData = ["01/22" "01/23" "01/24" "01/25" "01/26" "01/27" "01/28" "01/29"] yData = [557 655 ...

casi 5 años hace | 0

Respondida
How can i create this specific matrix??
i=3; j=4; A = kron(eye(j), ones(1,i))

casi 5 años hace | 0

| aceptada

Respondida
Dynamic colorbar change with window size corresponding with different data area
You can use the callback function of zoom to customize what you want. z = peaks(200); hi = imagesc(1:200, 1:200, z); colorbar...

casi 5 años hace | 0

| aceptada

Respondida
Adjusting width of horizontal colorbar
ax1 = gca; imagesc(peaks(80)) hcb=colorbar('SouthOutside'); ax1Pos = ax1.Position; pos = hcb.Position; pos(4) = 0.5*pos...

casi 5 años hace | 0

| aceptada

Respondida
How to set the order in iircomb filter?
The order of the IIR notch filter (using iircomb) is determined by the number of notches (equal to filter order plus 1). The sa...

casi 5 años hace | 0

| aceptada

Respondida
How to check adjacent data with logical indexing?
A=magic(5) idx1=A>20 idx1_right = circshift(idx1,1,2) idx1_left = circshift(idx1,-1,2) idx2 = idx1 & (A(idx1_left)>18 | A(...

casi 5 años hace | 0

| aceptada

Respondida
How to catch 'not enough input arguments' error?
Use try-catch: try spn=spans(index) catch whos index % show the inforamtion of the variable index disp(index)...

casi 5 años hace | 0

| aceptada

Respondida
How can I find a section of a graph?
% plot the curve t = 0:.1:5; x = cos(2*pi*3*(t-2.5))./(1+(t-2.5).^2*2); plot(t, x, 'b-'); % peak around 2.4-2.6 idx = find(...

casi 5 años hace | 1

Respondida
Rectangular Box plotting from four co-ordinate
caustom_plot=plot(x_points([1:end 1]),y_points([1:end 1]),'k','Linewidth',2);

casi 5 años hace | 0

Respondida
I need help to how to solve this
r_shape = [-1 0; 0 -1; 1 0; 0 1]; t_shape = [-0.5 -0.866; 1 0; -0.5 0.866]; plot(r_shape([1:end 1], 1), r_shape([1:end 1], 2)...

casi 5 años hace | 0

Respondida
Step response error when using step
Make the system casual (output does not depend on future input) before using step: s=tf('s'); sys=((-1.0024*(s+55.86)*(s+0.498...

casi 5 años hace | 0

Cargar más