Answered
Solving an equation containing sine and cosine
If you have the symbolic toolbox, use SOLVE: solve('A*cos(x)+B/sin(x)=C','x')

13 years ago | 1

| accepted

Answered
Impossible Ax=b is solved by linesolve(A,b) and mldivide(A,B)
From the documentation: " _If A is an m-by-n matrix with m ~= n and B is a column vector with m components, or a matrix with ...

13 years ago | 1

| accepted

Answered
Getting the default radio button value from a button group
GUI_8 demonstrates this. <http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples GUI_examples> ...

13 years ago | 0

Answered
How do I stop MATLAB from changing the focus to a random window after closing a dialog?
I cannot reproduce this. Perhaps if you use the figure command after you call DIALOG you can regain focus where you want. I as...

13 years ago | 0

Answered
Copy a figure then add more data
I am thinking this is a bug. The problem relates to the way legend works after COPYOBJ. It seems that MATLAB does not recogniz...

13 years ago | 1

Answered
element wise logical operators?
Do you mean this? DA = rand(4,4,2,3); DA(DA(:,2:4,:,:)<0.5) = 1; or perhaps you are talking about this (see the com...

13 years ago | 0

Answered
Binary matrix incrementer speed
You did not answer my question above, but here is another method. This produces the matrices in a different order than your cod...

13 years ago | 1

Answered
Concatenate matrix numbers linspace
p = 0:.5:3; or p = linspace(0,3,7) EDIT. I think I misunderstood your problem. Do you mean like this: ...

13 years ago | 0

Answered
Round to nearest odd integer
I don't think so, but you could make your own: function S = round_odd(S) % round to nearest odd integer. idx = mo...

13 years ago | 5

| accepted

Answered
Using latex command with anonymous functions
B = sym('B(x)'); latex(B) latex(subs(B,'x','y'))

13 years ago | 0

Answered
Quick Question! Get the Index
idx = find(~A) or idx = find(A~=0) or idx = find(A==0) or (this might be much faster if you are doing this...

13 years ago | 0

| accepted

Answered
How can i plot this signal?
f = @(t) 50+sin(t); v = @(t) 240*sin(2*pi*t.*f(t)); t = 0:.001:1; plot(t,v(t))

13 years ago | 0

Answered
are the first 3 elements of a vector NaN?
A is a cell. all(cellfun(@isnan,A(1:3)))

13 years ago | 0

| accepted

Answered
plotting a function from anothe .m file , please help
The problem is here: clear all; clc; t = i:1:12; Did you mean t = 1:12;

13 years ago | 0

| accepted

Answered
Referencing a line of code
Why not just Ctrl+f then type: SG = To find the line where that piece of code is located? This always works for me...

13 years ago | 1

Answered
Computing for a particular numerical value
Use the SUBS command. syms a x s = solve(x^3 + a*x + 1) a = 5; subs(s)

13 years ago | 3

| accepted

Answered
Gui Table With Editable Column Names
You could do something like this to save room: function [S] = GUI_table() % Save space and allow user to change column...

13 years ago | 1

Answered
Hot to change the settings of multiple gui components at the same time
Pass in a vector of the handles: u(1) = uicontrol; u(2) = uicontrol; u(3) = uicontrol; set(u,'units','norm')

13 years ago | 3

Answered
Retrieveing and replacing data in a plot
I'm a little confused. There is no ydata property for figures. Did you mask the GCF function with the line object's handles? ...

13 years ago | 0

| accepted

Answered
Fixe the number of digit when creating matrix
That is what I thought... Concatenating types like this will cause MATLAB to make M into an int32 M = [A,double(B)]

13 years ago | 0

| accepted

Answered
How to Automatically Change Line Color with plotyy?
The behavior you are seeing is the documented behavior or the LINE function. Try this: Time = 0:.01:10; EngineCoo...

13 years ago | 0

| accepted

Answered
Image as background in GUIDE
Check out GUI_40 here: <http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples> This was not m...

13 years ago | 0

| accepted

Answered
Piece-wise handle function help
It is not terribly efficient, but can be done: f = @(x) (x.^2).*(x<0)-(x.^2).*(x>=0); x = -10:.001:10; plot(x,f(x...

13 years ago | 1

Answered
why dendrogram is not working?
dendrogram(L,0,'labels',labels)

13 years ago | 0

| accepted

Answered
How do i construct this matrix with else and elseif statements? Or should i be using cases?
Here are a couple of suggestions. First the old-fashioned approach: A = diag(5*ones(1,12)) + ... diag(-3*ones(1,11),1) ...

13 years ago | 0

Answered
Why are there gaps in some of my plots?
You have nans in your data because of this: x2=0; D=1.003807*10^-7; u=0.0077; y=-0.11:0.0001:0.11; T = sqrt(...

13 years ago | 0

Answered
function opposite of ismember?
Use the logical negation symbol ~ismember(A,B) or the functional form: not(ismember(A,B))

13 years ago | 4

| accepted

Answered
How can I maintain to complex type when copying arrays?
This is documented behavior (not a bug), at least in r2007b. From the documentation for ISREAL, under remarks: "If B is re...

13 years ago | 0

Answered
index must be a positive integer or logical
The solution will depend on what you want to do. You could simply do: for idx = round(real_num) streaking(:,idx) = ...

13 years ago | 0

| accepted

Answered
Solve function with variables
You can specify the variables of interest to the solve command. S=solve('c^2/(2*R)+(2*delta_p*c*(pi-2))/(pi*Er)+ho-h_lk=0',...

13 years ago | 0

Load more