Question

multiplication by 0.5 vs division by 2

I tried the following with two options - matrix and scalar clear; N = 1e7; tic for n = 1:N % a=[n n;n n]/2; a = n/2; b...

2 months ago | 0 answers | 1

Question

is it a bug?

The code below (i) does not produce an error message about not matching x and y; it can be explained by implicit expansion in ...

3 months ago | 2 answers | 0

Question

which way to call function is better?

I have more than hundred of input parameters in myfunc and I am using the following way to call the function after grouping the ...

3 months ago | 2 answers | 0

Answered

GUI: Can't access data from another callback function with handles

G A on 31 Aug 2019 at 8:38 Put the line guidata(hObject, handles); at the end of your function control_browse_button_Callbac...

GUI: Can't access data from another callback function with handles

G A on 31 Aug 2019 at 8:38 Put the line guidata(hObject, handles); at the end of your function control_browse_button_Callbac...

3 months ago | 0

| accepted

Answered

How can I generate equal visual witdh bars with bar graph and log absciss scale ?

Instead of making the x-scale logarithmic by set(gca, 'xscale','log'), use linear x-scale and log10(Frequency) as X

How can I generate equal visual witdh bars with bar graph and log absciss scale ?

Instead of making the x-scale logarithmic by set(gca, 'xscale','log'), use linear x-scale and log10(Frequency) as X

5 months ago | 0

| accepted

Question

is it a bug?

In the following code, if view(2) or view(0,90) is defined before axis() which is not auto, then a default 3D figure will be plo...

5 months ago | 1 answer | 0

Answered

Creating a contour plot of magnitude in 3D

Something like this? a=-1:0.1:1; b=-1:0.1:1; [X,Y]=meshgrid(a,b); Z=X.^2+Y.^2; M=[0.5 1]; hold on grid on surf(X,Y,Z), ...

Creating a contour plot of magnitude in 3D

Something like this? a=-1:0.1:1; b=-1:0.1:1; [X,Y]=meshgrid(a,b); Z=X.^2+Y.^2; M=[0.5 1]; hold on grid on surf(X,Y,Z), ...

5 months ago | 1

Answered

Not obtaining the right shape with matlab plot

Add a dot ./ in the line: si=atan(sin((N+1).*phi)./(R./r3-cos((N+1).*phi)));

Not obtaining the right shape with matlab plot

Add a dot ./ in the line: si=atan(sin((N+1).*phi)./(R./r3-cos((N+1).*phi)));

5 months ago | 1

| accepted

Question

how can I do it without using eval

There are quite a few handles of uicontrols and uipanels named h1,h2...hN in my code exported by GUIDE. I want to create structu...

6 months ago | 1 answer | 0

Question

Is there the more elegant way to do this?

By trial and error I came to the following solution for choosing in my GUI a colormap and the number of colors to be used for my...

6 months ago | 1 answer | 0

Answered

Using Push Button to Export a String to an Edit Textbox (GUI)

set(handles.edit1,'String', Name); % Displaying my string "Name" into my Edit Textbox. Put this line in your pushbutton4_Callb...

Using Push Button to Export a String to an Edit Textbox (GUI)

set(handles.edit1,'String', Name); % Displaying my string "Name" into my Edit Textbox. Put this line in your pushbutton4_Callb...

6 months ago | 1

| accepted

Question

not documented in Matlab?

Both, ishandle(H) and ishghandle(H), are given in doc with only one input argument possibility, however ishghandle(H,'property...

6 months ago | 0 answers | 0

Question

Two fields Tooltip and TooltipString duplicating each other.

I was playing with my GUI exported by GUIDE from fig-file and found that there are two fields in object properties containing th...

7 months ago | 1 answer | 0

Answered

3d dimensional surface

v = [-2:0.1:2]; w = [-2:0.1:2]; [X,Y] = meshgrid(v,w); Z = 6*X.^2-4*X.^2.*Y.^2; figure(3); surf(X,Y,Z)

3d dimensional surface

v = [-2:0.1:2]; w = [-2:0.1:2]; [X,Y] = meshgrid(v,w); Z = 6*X.^2-4*X.^2.*Y.^2; figure(3); surf(X,Y,Z)

7 months ago | 1

Answered

How to combine plots on subplot?

figure(1) clf subplot(3,1,1) hold on plot(temp1,black1,'ko-'), plot(temp1,white1,'go-'), plot(temp1,pol1,'bo-'), plot(t...

How to combine plots on subplot?

figure(1) clf subplot(3,1,1) hold on plot(temp1,black1,'ko-'), plot(temp1,white1,'go-'), plot(temp1,pol1,'bo-'), plot(t...

7 months ago | 0

| accepted

Answered

How do I plot from multiple mfile into a same figure

Add "hold on" In your mfile2 anywhere before "plot(xfit,yfit)" : figure(2); %figure 2 hold on

How do I plot from multiple mfile into a same figure

Add "hold on" In your mfile2 anywhere before "plot(xfit,yfit)" : figure(2); %figure 2 hold on

7 months ago | 0

Answered

Low pass filtering in frequency domain

fft(x) usually returns a complex value. X_Mag = abs(fft(x)); - from here you are losing the information about the real and imagi...

Low pass filtering in frequency domain

fft(x) usually returns a complex value. X_Mag = abs(fft(x)); - from here you are losing the information about the real and imagi...

7 months ago | 0

Answered

Need help plotting multiple graphs in one UIAxes

Your if-statement is returning only one option. Try the following way: function GraphbButtonPushed(app, event) x =...

Need help plotting multiple graphs in one UIAxes

Your if-statement is returning only one option. Try the following way: function GraphbButtonPushed(app, event) x =...

7 months ago | 0

| accepted

Answered

I am trying to create a surface plot with nested loops and am getting the error "Z must be a matrix, not a scalar or vector."

Try something like the following (z must be a matrix): for m = 1:10 x(m) = m; for n = 1:10 y(n) = n; ...

I am trying to create a surface plot with nested loops and am getting the error "Z must be a matrix, not a scalar or vector."

Try something like the following (z must be a matrix): for m = 1:10 x(m) = m; for n = 1:10 y(n) = n; ...

8 months ago | 1

| accepted

Question

Is there the more elegant way to do this?

I would like to call arguments of function from a string or cell array. For example, this code works as I want: function te...

6 years ago | 2 answers | 0

Question

Why Matlab is not changing the name of the GUI window?

The names of my fig-file and main m-file are, for example, |'Version15.fig'| and |'Version15.m'| , however, after executing thos...

6 years ago | 2 answers | 0

Answered

How to read complex number from a *.csv file?

https://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/239213 http://smallbusiness.chron.com/read-csv-matlab-50663....

How to read complex number from a *.csv file?

https://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/239213 http://smallbusiness.chron.com/read-csv-matlab-50663....

6 years ago | 0

Solved

Swap the first and last columns

Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

6 years ago

Solved

Column Removal

Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; and ...

6 years ago

Solved

Determine if input is odd

Given the input n, return true if n is odd or false if n is even.

6 years ago

Solved

Fibonacci sequence

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

6 years ago

Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

6 years ago