Community Profile

# Ameer Hamza

### Hong Kong Polytechnic University

1,327 2016 年以降の合計貢献数

#### Ameer Hamza's バッジ

すべて表示

How assign specific colours (different from the colourmap ones) to regions of a matrix

How to apply two polygon on two outlines
Try this clc clear close all skip = 50; load('image2.mat'); image = preenc; % Identify the contours and its areas C...

| 採用済み

Multiple data set on System identification tool box
You can import data from multiple experiments, but only one can be used at a time to identify a model. Start the system identifi...

Try this x=linspace(0,10,100000000); y = 4*(1-exp(-0.001*x/(1.05*10^-4))); plot( x,y) xlim([0 25]) ylim([-20 20]) set(gc...

Substitute variable and find maximum of the function
The only function provided by Mathworks, of which I am aware, which can efficiently handle such mixed integer nonlinear programm...

| 採用済み

How to delete one of the two outlines of an image
Following code will select the smallest region and remove it from the image load('Image.mat'); image = preenc; Contour = bwco...

| 採用済み

How do I make a function provide a ordered list?
No need to use a for loop. myStruct(1).countries = 'ABCDEF'; myStruct(2).countries = 'ABCDEFGHI'; myStruct(3).countries = 'AB...

Simple operations with struct
idx = [struct_name.fieldname] > 50000; new_struct = struct_name(idx); new_struct will only contain elements where the field na...

| 採用済み

Strings vs Char and array indices
I guess in your code, the variable ii starts from 1 which try to read strlength(movies(0).countries) In MATLAB the array index...

| 採用済み

How can I fill each box in a box plot with a different colour?

Converting from 3D to 2D image
If you need a slice of 3D matrix, than try this out = CTimages(:,256,:) It will give you a 2D slice at 256 index of 2nd dimens...

MATLAB Code Error Help
It shows that the graphic object you are trying to change is already deleted. I think that you accidentally closed the figure wi...

| 採用済み

How to have more than one box plot in one plot?

| 採用済み

how to fill boxes in Boxplot with different colors
From the link posted by Poulomi, you can get different colors like this data = rand(100, 4); x = 1:4; colors = rand(4, 3); b...

Get specific number of timetable rows after specific timedate
Try something like this % example values t = datetime('1/1/2020 00:00:00'):hours(8):datetime('31/1/2020 23:59:59'); val = ran...

| 採用済み

Unable to perform assignment because the left and right sides have a different number of elements.
Just for the sake of future reference, the code related to this question can be found in this comment: https://www.mathworks.com...

| 採用済み

How do I plot a graph ode45
Just for the sake of future reference, the code related to this question can be found in this comment: https://www.mathworks.com...

| 採用済み

PLOTTING STEP RESPONSE OF TRANSFER FUNCTION USING FOURIER TRANSFORM
There are some issues in your code, compare it with the following code G = tf(1, [1 0.9 5]); [num,den] = tfdata(G); syms s t ...

Extract the value of a array from a function
In case the function period is a block-box or cannot be inverted, then you can an optimization-based approach to find its invers...

1日 前 | 0

Since my variable changes size on every loop iteration, how do I preallocate memory?
From you code, it appear that Activity_dff is of same size as Activity_smooth % Calculating Activity(k)-fd/fd for photometry A...

1日 前 | 0

Convert python code to matlab code
Something like this pos(pos < lb) = lb; pos(pos > ub) = ub; fitness = zeros(1,PopSize); for i=1:PopSize fitness(i)=ob...

1日 前 | 0

comparison of query image feature and 1000 image feature which stored in .mat file
Try this, V1 = rand(1000,16); % random values for example V = rand(1,16); [~,idx] = min(sum((V1-V).^2, 2)); closest_sample...

1日 前 | 0

split an image into six equal parts
This code shows one example. However, this will only work if the number of pixels in the image can be evenly divided into blocks...

1日 前 | 0

Minimising the variance of a portfolio using weights of assets and covariance matrix
As Thiago pointed out, you can use Quadprog, and in this case, it will work, but the portfolio optimization model can become qui...

1日 前 | 0

Error using .* Matrix dimensions must agree.
You didn't attach the time and data variables, so I can only speculate, but it seems that okno1 is a column matrix, 'm' is a row...

1日 前 | 0

| 採用済み

how can I show my Xaxis format like 10^..?
There are several redundant steps in your code. Try this figure(3) plot(subsetA(1:7,30),subsetA(1:7,4),'-o','LineWidth',2) ho...

1日 前 | 0

how do I plot 3d graph?
It is creating 3D line, but it is not visible because you run the hold(ax) at the beginning. Add the view(3) line like this to s...

1日 前 | 1

| 採用済み

why the fourier series coefficient answer in matlab different compare to my manually calculation
As pointed by John in his comment. You need to specify that the symbolic variable n is integer explicitly. You assume() to infor...

1日 前 | 1

| 採用済み

fmincon minimum number of iterations
This shows how you can force fmincon to keep searching until a fixed number of iterations is reached. It uses a simple objective...

1日 前 | 0

| 採用済み

plotting a point in 3D
You can draw this point using plot3() P = transpose([2,3,4,0]); New_P = trotx(45) * P; plot3(New_P(1), New_P(2), New_P(3), ...

1日 前 | 0

| 採用済み