Community Profile

# Ameer Hamza

### Hong Kong Polytechnic University

4.467 total contributions since 2016

3.1416

#### Ameer Hamza's Badges

View all

Contributions in
View by

How to crop an image using matrices
You can use imcrop(): https://www.mathworks.com/help/images/ref/imcrop.html and then apply imresize(): https://www.mathworks.com...

34 minutos ago | 0

Extracting data from cell array: Unable to perform assignment because the indices on the left side are not compatible with the size of the right side
Can you explain in which form do you want the output? The following show how you can extract those values and store them in a ce...

alrededor de 2 horas ago | 0

simulink scope range from 0 to 5
Change the stop time of your simulation to 5. Why do you need to run simulation after that? The other option is this: In scope ...

alrededor de 3 horas ago | 0

Evaluate a vectorial symbolic matlab function through Matrices and vectors directly
The function handle is not being created in the way you want. Change the matlabFunction line to q = matlabFunction(qsym, 'Vars'...

alrededor de 3 horas ago | 0

| accepted

Find, sort and assign values in matrix
Are you trying to get something like this q3 = [ 1.0000 2.0000 90.0000 4.9424 2.0000 3.0000 91.0000 ...

alrededor de 3 horas ago | 0

| accepted

How do I control exponent in plot
You need to set the exponent property of x-axis'. Something like this ax = gca; ax.XAxis.Exponent = 18;

alrededor de 3 horas ago | 0

| accepted

Wrong output from eigs function
According to the documentation of eigs(), by default, it returns 6 largest eigenvalues and their corresponding eigenvectors. Mat...

alrededor de 4 horas ago | 0

| accepted

How to solve non-linear equations having modulus expression?
See lsqnolin(): https://www.mathworks.com/help/optim/ug/lsqnonlin.html. Or fmincon(): https://www.mathworks.com/help/optim/ug/...

alrededor de 6 horas ago | 0

System of linear equations
See solve(): https://www.mathworks.com/help/symbolic/solve.html from The Symbolic Math toolbox.

alrededor de 8 horas ago | 0

MATLAB Function Generates the Vertices of a Regular N-gon with Line Segments
You need n+1 points, because points at angle of 0 and 2*pi are same. t = linspace(0,1,n+1); Can you explain, what do you mean ...

alrededor de 22 horas ago | 0

Converting cell array to matrix
Use vertcat() coord = vertcat(centroid1{:}) following should also work coord = cell2mat(centroid1.')

alrededor de 22 horas ago | 0

| accepted

How to make the y axis 'counts' and x axis the variable on Histograms
One option is to just rotate the view x = rand(1000,1); histogram(x) view(90, 90) Combining histcounts() with barh() is anot...

alrededor de 22 horas ago | 0

Infinite Recursion in own Levenberg-Marquardt Code
Inside the function korrektur, you are again calling korrektur with the same value of input parameter [s,mu]=korrektur(f,DF,x,...

alrededor de 23 horas ago | 1

imwrite error for saving contents of a cell array in a for loop - "colourmap should have 3 columns"?
Why are you getting the indexed image in frame2im(). Getting an RGB image will make things easier. Change the line to figureIm ...

alrededor de 23 horas ago | 2

| accepted

How to Select Specific Time Intervals Over a series of time steps
Is the data loaded in MATLAB? If yes, you can do something like this dts; % datetime vector; Transp_val; % Transpiration value...

alrededor de 23 horas ago | 0

| accepted

Simulink: Excite System for couple seconds but longer simulation time
There can be several ways, but the easiest might be to use a MATLAB function block: https://www.mathworks.com/help/simulink/ug/c...

alrededor de 23 horas ago | 0

| accepted

How to plot scatter graph with colourmap functon
Try this x = myVal(:,1); y = myVal(:,2); z = myVal(:,3); cmap = jet(256); %state colourmaop min_val = min(z); max_val = ...

alrededor de 23 horas ago | 0

| accepted

multiple function_handle in one function
Instead of defining three function handles, you can defined one vector-valued functions df = @(a) [2.*((sqrt((x1-a(1)).^2 + (y1...

alrededor de 24 horas ago | 1

Use Matlab online for machine learning
MATLAB online itself does not have enough power to do something serious. For example, it does not have a GPU device. You can run...

1 día ago | 0

How to Write y(0)=1?
If you just want to display it, then you can use following code syms J(theta) J(theta)=1 This requires the Symbolic toolbox.

1 día ago | 0

How sampling 3d scattered points
One option is to use interp1() X = rand(108, 3); t = linspace(0,1,size(X,1)); t_new = linspace(0,1,32); X_new = interp1(t,...

1 día ago | 1

How to find the Fourier transform X(ω)
fourier() works with symbolic inputs syms t x(t) = (t*exp(-3*t)*sin(8*t))*heaviside(t); fourier(x)

1 día ago | 0

| accepted

How to use isosurface in app designer?
isosurface() surface is quite an old function and does not support these features. According to the documentation, it will just ...

1 día ago | 0

4th order differential equation
If you have symbolic toolbox, then try this syms v(z) P EI eq = EI*diff(v,4) == -P*z v = dsolve(eq) Result from live edito...

1 día ago | 0

Read two lines from a file and repeat for next lines
It is more efficient to read everything in a single call. I/O operations on disk can be a bottleneck, so that should be reduced ...

1 día ago | 0

| accepted

How to create a variable named from string
Although possible, it is a terrible (cannot emphasize enough) coding practice to create variable names dynamically: https://www....

1 día ago | 0

| accepted

Pseudo random sequence matrix from an image
As the documentation specifies, the Y matrix has values in the range [16 235]/255 for the floating-point datatype. You can do so...

1 día ago | 0

Grouping of sub arrays
Are you looking for something like this x=[1 1 2 3 3 1 0 4 4 4 1 1 1 1 5 5 0 1 3 3 3 3 1 4 4 4 0 0 1 1 5 6]; Groups = bwlabe...

1 día ago | 0

| accepted

How to create a graph time vs value n
I think it might be better if you move the tic ... toc lines outside the function. For example, remove these lines and then run ...

1 día ago | 0