Plotting a semilogx plot with a table

3 visualizaciones (últimos 30 días)
Nat Person
Nat Person el 5 de En. de 2021
Comentada: Nat Person el 5 de En. de 2021
I'm trying to plot two tables (Final & Inital, both 201x2) using the semilogx function.
Here's how I'm trying to do it.
subplot (2,1,1)
semilogx(Initial{:,1},Initial{:,2})
title('Final & Initial Measurements')
xlabel ('Frequency'); ylabel('Magnitude')
hold on
semilogx(Final(:,1),Final(:,2))
xlabel ('Frequency (Hz)'); ylabel('Magnitude (dB)');
legend('InM'+n+'','FM'+n+'');
hold off
But it keeps throwing the error
Error using semilogx
Data must be numeric, datetime, duration or an array convertible to double.
How do I get around this?
Thank you for any help!

Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de En. de 2021
semilogx(Initial{:,1},Initial{:,2})
That line you got right
semilogx(Final(:,1),Final(:,2))
But not that one.
Notice that the first time you used {} indexing but the second time you used ()

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by