Community Profile

# Ameer Hamza

### Hong Kong Polytechnic University

2,511 total contributions since 2016

View all

Contributions in
View by

exportgraphics r2020a issue
I didn't face this problem in R2020a update 2, however, I remember observing something like this (not exactly sure if it was exp...

5 hours ago | 0

Choose numerical type for table2array output
Seomthing like this T=table; T.var1=ones(10,1,'uint8'); T.var2=1000*ones(10,1,'double'); array = structfun(@double, table2st...

14 hours ago | 0

regexp: \w* vs \w+
\w does not match spaces. \s is used to match spaces. \w only matches a-z A-Z 0-9 and underscore. Following attempts to show the...

15 hours ago | 0

| accepted

Slow computation speed using piecewise functions
Functions such as triangularPulse and piecewise are from the symbolic toolbox, and they can be very slow as compare to floating-...

18 hours ago | 0

| accepted

Maximum recursion limit error
ode45 should be called outside the ODE function. Your actual ode function is this function dv=Question3(t,v) % dv/dt=8-4 dv=4...

18 hours ago | 1

| accepted

Input system nonlinear (Identification)
You can use randn() u = randn(1, 1000);

18 hours ago | 0

Problem relating to mathematical expression
Try this x = [0.1, 0.2, 0.4, 0.5, 0.4, 0.6, 0.6, 0.6, 0.2, 0.3]; n = numel(x); k = 5; if round(n/k)==n/k split = mat2ce...

18 hours ago | 0

How to modify decimal places when exporting data with fprintf
Try this code a = {'C1', 'A1', 'B1'}' b = {'C', 'A', 'B'}' c = {1.1, 2.1, 3.1}' d = {1.16666, 2.16666, 3.16666}' e = {'C', ...

19 hours ago | 2

| accepted

Nernst Equation plotting in MATLAB
Try this code, I changed the range of T1 and used element-wise operator in the equation for Eout1 %Constant Temperature and Cha...

24 hours ago | 0

| accepted

How can find the solution of this matrix system?
Try fsolve(): https://www.mathworks.com/help/releases/R2020a/optim/ug/fsolve.html sol = fsolve(@(X) X*A*X.'-B, rand(size(A)))

1 day ago | 0

How to display a variable for x and y values from code in UI Table
Run this example x1 = 1; x2 = 2; x3 = 3; y1 = 4; y2 = 5; y3 = 6; x = [x1; x2; x3]; y = [y1; y2; y3]; t = table(x, y); ...

1 day ago | 0

Is there a way to make dirac delta function be 1 at the origin?
Replace dirac with kroneckerDelta syms x f(x) = heaviside(x); g(x) = diff(f); Result >> g(0) ans = Inf Now run g(x) = s...

1 day ago | 0

| accepted

Filtering by several criteria
Something like this New=Salaries.Age_49(Salaries.Area==1 & Salaries.Year==2019) % find is not necessary, logical indexing will ...

1 day ago | 0

How do I correctly type in the following functions into matlab
This is correct syntax syms theta t f1 = 1 + sin(theta)^2*csc(theta); f2 = 1/(1+sin(theta)); f3 = sin(t); f4 = sec(theta).^...

1 day ago | 0

create plot with slice
Try this [X, Y, Z] = meshgrid(0:0.5:20, 0:0.5:20, 1:7); V = exp(-0.2*sqrt((X-10).^2+(Y-10).^2+(2*(Z-4)).^2)); % based on gue...

1 day ago | 0

How to pass a changing value from workspaces to Simulink?
If the value is continually changing in the base workspace, you need to use MATLAB function block and evalin() to read the updat...

1 day ago | 1

| accepted

Trial to display Capital letters on excel
xlswrite is used to write numeric matrices. If you want to write text data, then use writetable() or writecell(). For example T...

1 day ago | 0

How to insert a background image into a 3d plot?
Try something like this img = imread('peacock.jpg'); ax1 = axes(); imshow(img, 'Parent', ax1); ax2 = axes('Color', 'none...

1 day ago | 0

| accepted

How to create sum block like this (photo) on simulink?

1 day ago | 0

how can i solve this problem
In the expressions of kiv and kdv, there is kp in the denominator. So, you should start the list of Kp from a non-zero value, fo...

1 day ago | 0

| accepted

Variable in plot title
Run this example titles = {'title1', 'title2', 'title3'}; for i=1:3 figure(i) plot(rand(1,10)); title(titles{...

1 day ago | 1

| accepted

Sorting maximum value array by same date and time
Try this T = readtable('test1.xlsx'); grps = findgroups(T.Time, T.Date); max_vals = splitapply(@max, T.Value, grps); T.Max...

1 day ago | 1

create specific color map and save it
Try this val_z = (10:51).'; idx = 1*(val_z<=10) + ... 2*((10<val_z) & (val_z<=25)) + ... 3*((25<val_z) & (val_z<=50)...

1 day ago | 0

| accepted

MATLAB on ramp, section 5.2, further practice.
Read this: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html. For example x = [1 2 3 4 5 6 ...

1 day ago | 0

contourf with more colours
You can specify the 4 input argument to contourf() to specify the number of levels you want. contourf(x,y,z,50); % 50 levels wi...

1 day ago | 0

| accepted

solve integral using ode45 (by derivative)
Try this M = @(T) integral(@(lambda) planck(lambda,T), 4e-7, 7e-7); s = M(10000); % T=10000 function me=planck(lambda,T) h...

1 day ago | 0

how to obtain the mean for single variable/location of a multiple 3d .mat file ?
Something like this files=dir('*.mat'); totalfile = numel(files); V = zeros(1,totalfile); for a = 1:tot...

1 day ago | 0

| accepted

How to plot a, as varibale stored chart?
MATLAB graphics objects cannot be saved as variable by using their handles. Once the figure closes, the handle becomes invalid. ...

2 days ago | 0