Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
The question is, I have this table: 1 2 3 4 5 6 7 8 9. I need turn it so:
1 2 3 3.5 4 4.5 5 5.5 6 6.5 7 8 9. What function in MATLAB allows me do that? Or I must make it by myself? I'm already understand my problem.
I guess an first order interpolation is what you want.
How to handle the funktion interp1 is explained in the Matlab Manual.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 months ago.
Improve this question
I am trying to simplify an expression which has an unknown varaible in it. I am doing it in scala and I am using case classes. The thing is I don't know how to handle an unknown variable e.g when 4 * 4 * x should become 16 * x but I don't know how to get the * x. Can anyone help
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I understand how the program works but I have a little bit of confusion. If anybody can explain, that will be great. The output is 21, 12. Does it work like 7*3=21 and 4*3=12?
mat=[7 11 3; 3:5];
[r,c]=size(mat);
for i=1:r
fprintf ('The sum is %d\n',sum(mat(i,:)))
end
mat(i,:) will give you all values in the first row of mat. In your example, this first row is [7 11 3], and the second row is [3 4 5]. The outputs you're seeing are the sums of all values in each row (7+11+3=21).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
For example, let's say I want to pack the following bits: 11111 which is 31 in decimal. How can I pack these 5 bits? I don't want to pack 8 bits or 1 byte. I need to pack only 5 bits; 11111
b5 "11111" doesn't seem to work for me.
works for me :
print oct "0b11111";
31
print ord(pack("b*","11111"));
31
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I need to do an optimization problem using ga algorithm. The number of decision variable is 3. i.e 3 x 1 matrix. but first element is always 0. keeping this as reference I want to optmize other two variables. How can I do this task?
Then just use
lb = [0,0,0];
ub = [0,8,8];
IntCon = [0 2 3];
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In MATLAB, how can I fetch all the element in A but not in B?
If
A = [1 2 3 4 5 6 7 8];
B = [1 2 3];
I hope the answer to be [4 5 6 7 8].
It sounds like you need setdiff().
As Oli stated you can use setdiff, however a little faster way to perform the same operation is
C = A(~ismember(A, B));
setdiff also sorts the resulting array, if you need this you have to sort C in the above statement